提交 7e874326 编写于 作者: J Jiri Denemark

qemu: Use correct host model for updating guest cpu

When a user requested a domain XML description with
VIR_DOMAIN_XML_UPDATE_CPU flag, libvirt would use the host CPU
definition from host capabilities rather than the one which will
actually be used once the domain is started.

https://bugzilla.redhat.com/show_bug.cgi?id=1481309Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 43a90eb7
......@@ -4561,6 +4561,7 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver,
int ret = -1;
virDomainDefPtr copy = NULL;
virCapsPtr caps = NULL;
virQEMUCapsPtr qemuCaps = NULL;
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup;
......@@ -4579,7 +4580,14 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver,
def->cpu &&
(def->cpu->mode != VIR_CPU_MODE_CUSTOM ||
def->cpu->model)) {
if (virCPUUpdate(def->os.arch, def->cpu, caps->host.cpu) < 0)
if (!(qemuCaps = virQEMUCapsCacheLookupCopy(driver->qemuCapsCache,
def->emulator,
def->os.machine)))
goto cleanup;
if (virCPUUpdate(def->os.arch, def->cpu,
virQEMUCapsGetHostModel(qemuCaps, def->virtType,
VIR_QEMU_CAPS_HOST_CPU_MIGRATABLE)) < 0)
goto cleanup;
}
......@@ -4697,6 +4705,7 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver,
cleanup:
virDomainDefFree(copy);
virObjectUnref(caps);
virObjectUnref(qemuCaps);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册