mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: Pass migratable host model to virCPUUpdate
This will allow us to drop feature filtering from virCPUUpdate where it was just a hack. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
dfc711dc8c
commit
959e72d323
@ -2446,12 +2446,20 @@ virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps,
|
|||||||
|
|
||||||
virCPUDefPtr
|
virCPUDefPtr
|
||||||
virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps,
|
virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps,
|
||||||
virDomainVirtType type)
|
virDomainVirtType type,
|
||||||
|
bool migratable)
|
||||||
{
|
{
|
||||||
|
virQEMUCapsCPUModelPtr model;
|
||||||
|
|
||||||
if (type == VIR_DOMAIN_VIRT_KVM)
|
if (type == VIR_DOMAIN_VIRT_KVM)
|
||||||
return qemuCaps->hostCPU.kvm.full;
|
model = &qemuCaps->hostCPU.kvm;
|
||||||
else
|
else
|
||||||
return qemuCaps->hostCPU.tcg.full;
|
model = &qemuCaps->hostCPU.tcg;
|
||||||
|
|
||||||
|
if (migratable)
|
||||||
|
return model->migratable;
|
||||||
|
else
|
||||||
|
return model->full;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2469,7 +2477,7 @@ virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps,
|
|||||||
virQEMUCapsGuestIsNative(caps->host.arch, qemuCaps->arch);
|
virQEMUCapsGuestIsNative(caps->host.arch, qemuCaps->arch);
|
||||||
|
|
||||||
case VIR_CPU_MODE_HOST_MODEL:
|
case VIR_CPU_MODE_HOST_MODEL:
|
||||||
return !!virQEMUCapsGetHostModel(qemuCaps, type);
|
return !!virQEMUCapsGetHostModel(qemuCaps, type, false);
|
||||||
|
|
||||||
case VIR_CPU_MODE_CUSTOM:
|
case VIR_CPU_MODE_CUSTOM:
|
||||||
if (type == VIR_DOMAIN_VIRT_KVM)
|
if (type == VIR_DOMAIN_VIRT_KVM)
|
||||||
@ -5534,7 +5542,8 @@ virQEMUCapsFillDomainCPUCaps(virCapsPtr caps,
|
|||||||
|
|
||||||
if (virQEMUCapsIsCPUModeSupported(qemuCaps, caps, domCaps->virttype,
|
if (virQEMUCapsIsCPUModeSupported(qemuCaps, caps, domCaps->virttype,
|
||||||
VIR_CPU_MODE_HOST_MODEL)) {
|
VIR_CPU_MODE_HOST_MODEL)) {
|
||||||
virCPUDefPtr cpu = virQEMUCapsGetHostModel(qemuCaps, domCaps->virttype);
|
virCPUDefPtr cpu = virQEMUCapsGetHostModel(qemuCaps, domCaps->virttype,
|
||||||
|
false);
|
||||||
domCaps->cpu.hostModel = virCPUDefCopy(cpu);
|
domCaps->cpu.hostModel = virCPUDefCopy(cpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,7 +450,8 @@ int virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps,
|
|||||||
char ***names,
|
char ***names,
|
||||||
size_t *count);
|
size_t *count);
|
||||||
virCPUDefPtr virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps,
|
virCPUDefPtr virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps,
|
||||||
virDomainVirtType type);
|
virDomainVirtType type,
|
||||||
|
bool migratable);
|
||||||
bool virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps,
|
bool virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps,
|
||||||
virCapsPtr caps,
|
virCapsPtr caps,
|
||||||
virDomainVirtType type,
|
virDomainVirtType type,
|
||||||
|
@ -6887,7 +6887,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
|
|||||||
if (def->cpu->mode == VIR_CPU_MODE_CUSTOM)
|
if (def->cpu->mode == VIR_CPU_MODE_CUSTOM)
|
||||||
cpuDef = def->cpu;
|
cpuDef = def->cpu;
|
||||||
else if (def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH)
|
else if (def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH)
|
||||||
cpuDef = virQEMUCapsGetHostModel(qemuCaps, def->virtType);
|
cpuDef = virQEMUCapsGetHostModel(qemuCaps, def->virtType, false);
|
||||||
|
|
||||||
if (cpuDef) {
|
if (cpuDef) {
|
||||||
int svm = virCPUCheckFeature(def->os.arch, cpuDef, "svm");
|
int svm = virCPUCheckFeature(def->os.arch, cpuDef, "svm");
|
||||||
|
@ -5304,12 +5304,12 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def,
|
|||||||
|
|
||||||
if (def->cpu->check == VIR_CPU_CHECK_PARTIAL &&
|
if (def->cpu->check == VIR_CPU_CHECK_PARTIAL &&
|
||||||
virCPUCompare(caps->host.arch,
|
virCPUCompare(caps->host.arch,
|
||||||
virQEMUCapsGetHostModel(qemuCaps, def->virtType),
|
virQEMUCapsGetHostModel(qemuCaps, def->virtType, false),
|
||||||
def->cpu, true) < 0)
|
def->cpu, true) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (virCPUUpdate(def->os.arch, def->cpu,
|
if (virCPUUpdate(def->os.arch, def->cpu,
|
||||||
virQEMUCapsGetHostModel(qemuCaps, def->virtType)) < 0)
|
virQEMUCapsGetHostModel(qemuCaps, def->virtType, true)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virQEMUCapsGetCPUDefinitions(qemuCaps, def->virtType,
|
if (virQEMUCapsGetCPUDefinitions(qemuCaps, def->virtType,
|
||||||
|
@ -393,6 +393,7 @@ cpuTestUpdate(const void *arg)
|
|||||||
const struct data *data = arg;
|
const struct data *data = arg;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
virCPUDefPtr host = NULL;
|
virCPUDefPtr host = NULL;
|
||||||
|
virCPUDefPtr migHost = NULL;
|
||||||
virCPUDefPtr cpu = NULL;
|
virCPUDefPtr cpu = NULL;
|
||||||
char *result = NULL;
|
char *result = NULL;
|
||||||
|
|
||||||
@ -400,7 +401,10 @@ cpuTestUpdate(const void *arg)
|
|||||||
!(cpu = cpuTestLoadXML(data->arch, data->name)))
|
!(cpu = cpuTestLoadXML(data->arch, data->name)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virCPUUpdate(host->arch, cpu, host) < 0)
|
if (!(migHost = virCPUCopyMigratable(data->arch, host)))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virCPUUpdate(host->arch, cpu, migHost) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virAsprintf(&result, "%s+%s", data->host, data->name) < 0)
|
if (virAsprintf(&result, "%s+%s", data->host, data->name) < 0)
|
||||||
@ -411,6 +415,7 @@ cpuTestUpdate(const void *arg)
|
|||||||
cleanup:
|
cleanup:
|
||||||
virCPUDefFree(host);
|
virCPUDefFree(host);
|
||||||
virCPUDefFree(cpu);
|
virCPUDefFree(cpu);
|
||||||
|
virCPUDefFree(migHost);
|
||||||
VIR_FREE(result);
|
VIR_FREE(result);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user