Revert "qemu: Store migratable host CPU model in qemuCaps"
This reverts commit dfc711dc8cf08e942b01e6ead3de117e6522e5cd which was pushed accidentally.
This commit is contained in:
parent
0268df4020
commit
9ad3cd16d6
@ -373,14 +373,6 @@ struct virQEMUCapsMachineType {
|
|||||||
unsigned int maxCpus;
|
unsigned int maxCpus;
|
||||||
bool hotplugCpus;
|
bool hotplugCpus;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _virQEMUCapsCPUModel virQEMUCapsCPUModel;
|
|
||||||
typedef virQEMUCapsCPUModel *virQEMUCapsCPUModelPtr;
|
|
||||||
struct _virQEMUCapsCPUModel {
|
|
||||||
virCPUDefPtr full;
|
|
||||||
virCPUDefPtr migratable;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update the XML parser/formatter when adding more
|
* Update the XML parser/formatter when adding more
|
||||||
* information to this struct so that it gets cached
|
* information to this struct so that it gets cached
|
||||||
@ -423,8 +415,8 @@ struct _virQEMUCaps {
|
|||||||
* time we probe QEMU or load the results from the cache.
|
* time we probe QEMU or load the results from the cache.
|
||||||
*/
|
*/
|
||||||
struct {
|
struct {
|
||||||
virQEMUCapsCPUModel kvm;
|
virCPUDefPtr kvm;
|
||||||
virQEMUCapsCPUModel tcg;
|
virCPUDefPtr tcg;
|
||||||
} hostCPU;
|
} hostCPU;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2109,20 +2101,12 @@ virQEMUCapsCopyHostCPUData(virQEMUCapsPtr dst,
|
|||||||
!(dst->tcgCPUModelInfo = qemuMonitorCPUModelInfoCopy(src->tcgCPUModelInfo)))
|
!(dst->tcgCPUModelInfo = qemuMonitorCPUModelInfoCopy(src->tcgCPUModelInfo)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (src->hostCPU.kvm.full &&
|
if (src->hostCPU.kvm &&
|
||||||
!(dst->hostCPU.kvm.full = virCPUDefCopy(src->hostCPU.kvm.full)))
|
!(dst->hostCPU.kvm = virCPUDefCopy(src->hostCPU.kvm)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (src->hostCPU.kvm.migratable &&
|
if (src->hostCPU.tcg &&
|
||||||
!(dst->hostCPU.kvm.migratable = virCPUDefCopy(src->hostCPU.kvm.migratable)))
|
!(dst->hostCPU.tcg = virCPUDefCopy(src->hostCPU.tcg)))
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (src->hostCPU.tcg.full &&
|
|
||||||
!(dst->hostCPU.tcg.full = virCPUDefCopy(src->hostCPU.tcg.full)))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (src->hostCPU.tcg.migratable &&
|
|
||||||
!(dst->hostCPU.tcg.migratable = virCPUDefCopy(src->hostCPU.tcg.migratable)))
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -2217,10 +2201,8 @@ void virQEMUCapsDispose(void *obj)
|
|||||||
|
|
||||||
qemuMonitorCPUModelInfoFree(qemuCaps->kvmCPUModelInfo);
|
qemuMonitorCPUModelInfoFree(qemuCaps->kvmCPUModelInfo);
|
||||||
qemuMonitorCPUModelInfoFree(qemuCaps->tcgCPUModelInfo);
|
qemuMonitorCPUModelInfoFree(qemuCaps->tcgCPUModelInfo);
|
||||||
virCPUDefFree(qemuCaps->hostCPU.kvm.full);
|
virCPUDefFree(qemuCaps->hostCPU.kvm);
|
||||||
virCPUDefFree(qemuCaps->hostCPU.kvm.migratable);
|
virCPUDefFree(qemuCaps->hostCPU.tcg);
|
||||||
virCPUDefFree(qemuCaps->hostCPU.tcg.full);
|
|
||||||
virCPUDefFree(qemuCaps->hostCPU.tcg.migratable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -2449,9 +2431,9 @@ virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps,
|
|||||||
virDomainVirtType type)
|
virDomainVirtType type)
|
||||||
{
|
{
|
||||||
if (type == VIR_DOMAIN_VIRT_KVM)
|
if (type == VIR_DOMAIN_VIRT_KVM)
|
||||||
return qemuCaps->hostCPU.kvm.full;
|
return qemuCaps->hostCPU.kvm;
|
||||||
else
|
else
|
||||||
return qemuCaps->hostCPU.tcg.full;
|
return qemuCaps->hostCPU.tcg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3298,40 +3280,26 @@ virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static virCPUDefPtr
|
|
||||||
virQEMUCapsNewHostCPUModel(void)
|
|
||||||
{
|
|
||||||
virCPUDefPtr cpu;
|
|
||||||
|
|
||||||
if (VIR_ALLOC(cpu) < 0)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
cpu->type = VIR_CPU_TYPE_GUEST;
|
|
||||||
cpu->mode = VIR_CPU_MODE_CUSTOM;
|
|
||||||
cpu->match = VIR_CPU_MATCH_EXACT;
|
|
||||||
cpu->fallback = VIR_CPU_FALLBACK_ALLOW;
|
|
||||||
|
|
||||||
return cpu;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
|
virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
|
||||||
virCapsPtr caps,
|
virCapsPtr caps,
|
||||||
virDomainVirtType type)
|
virDomainVirtType type)
|
||||||
{
|
{
|
||||||
virCPUDefPtr cpu = NULL;
|
virCPUDefPtr cpu = NULL;
|
||||||
virCPUDefPtr migCPU = NULL;
|
|
||||||
virCPUDefPtr hostCPU = NULL;
|
virCPUDefPtr hostCPU = NULL;
|
||||||
virQEMUCapsCPUModelPtr model;
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (!caps || !virQEMUCapsGuestIsNative(caps->host.arch, qemuCaps->arch))
|
if (!caps || !virQEMUCapsGuestIsNative(caps->host.arch, qemuCaps->arch))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(cpu = virQEMUCapsNewHostCPUModel()))
|
if (VIR_ALLOC(cpu) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
cpu->type = VIR_CPU_TYPE_GUEST;
|
||||||
|
cpu->mode = VIR_CPU_MODE_CUSTOM;
|
||||||
|
cpu->match = VIR_CPU_MATCH_EXACT;
|
||||||
|
cpu->fallback = VIR_CPU_FALLBACK_ALLOW;
|
||||||
|
|
||||||
if ((rc = virQEMUCapsInitCPUModel(qemuCaps, type, cpu, false)) < 0) {
|
if ((rc = virQEMUCapsInitCPUModel(qemuCaps, type, cpu, false)) < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
} else if (rc == 1) {
|
} else if (rc == 1) {
|
||||||
@ -3345,26 +3313,10 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(migCPU = virQEMUCapsNewHostCPUModel()))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
if ((rc = virQEMUCapsInitCPUModel(qemuCaps, type, migCPU, true)) < 0) {
|
|
||||||
goto error;
|
|
||||||
} else if (rc == 1) {
|
|
||||||
VIR_DEBUG("CPU migratibility not provided by QEMU");
|
|
||||||
|
|
||||||
virCPUDefFree(migCPU);
|
|
||||||
if (!(migCPU = virCPUCopyMigratable(qemuCaps->arch, cpu)))
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == VIR_DOMAIN_VIRT_KVM)
|
if (type == VIR_DOMAIN_VIRT_KVM)
|
||||||
model = &qemuCaps->hostCPU.kvm;
|
qemuCaps->hostCPU.kvm = cpu;
|
||||||
else
|
else
|
||||||
model = &qemuCaps->hostCPU.tcg;
|
qemuCaps->hostCPU.tcg = cpu;
|
||||||
|
|
||||||
model->full = cpu;
|
|
||||||
model->migratable = migCPU;
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virCPUDefFree(hostCPU);
|
virCPUDefFree(hostCPU);
|
||||||
@ -3372,7 +3324,6 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
virCPUDefFree(cpu);
|
virCPUDefFree(cpu);
|
||||||
virCPUDefFree(migCPU);
|
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -4120,10 +4071,8 @@ virQEMUCapsReset(virQEMUCapsPtr qemuCaps)
|
|||||||
qemuCaps->kvmCPUModelInfo = NULL;
|
qemuCaps->kvmCPUModelInfo = NULL;
|
||||||
qemuCaps->tcgCPUModelInfo = NULL;
|
qemuCaps->tcgCPUModelInfo = NULL;
|
||||||
|
|
||||||
virCPUDefFree(qemuCaps->hostCPU.kvm.full);
|
virCPUDefFree(qemuCaps->hostCPU.kvm);
|
||||||
virCPUDefFree(qemuCaps->hostCPU.kvm.migratable);
|
virCPUDefFree(qemuCaps->hostCPU.tcg);
|
||||||
virCPUDefFree(qemuCaps->hostCPU.tcg.full);
|
|
||||||
virCPUDefFree(qemuCaps->hostCPU.tcg.migratable);
|
|
||||||
memset(&qemuCaps->hostCPU, 0, sizeof(qemuCaps->hostCPU));
|
memset(&qemuCaps->hostCPU, 0, sizeof(qemuCaps->hostCPU));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user