提交 8f55eef2 编写于 作者: J Jiri Denemark

qemu: Use saner defaults for domain capabilities

When domain capabilities were introduced we did not have enough data to
decide whether KVM works on the host or not and thus working legacy/VFIO
device assignment was used as a witness. Now that we know whether KVM
was enabled when probing QEMU capabilities (and thus we know it's
working), we can use this knowledge to provide better default value for
virttype.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 d87df9bd
......@@ -18718,7 +18718,7 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
char *ret = NULL;
virQEMUDriverPtr driver = conn->privateData;
virQEMUCapsPtr qemuCaps = NULL;
int virttype; /* virDomainVirtType */
int virttype = VIR_DOMAIN_VIRT_NONE;
virDomainCapsPtr domCaps = NULL;
int arch = virArchFromHost(); /* virArch */
virQEMUDriverConfigPtr cfg = NULL;
......@@ -18734,12 +18734,6 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup;
if (qemuHostdevHostSupportsPassthroughLegacy() ||
qemuHostdevHostSupportsPassthroughVFIO())
virttype = VIR_DOMAIN_VIRT_KVM;
else
virttype = VIR_DOMAIN_VIRT_QEMU;
if (virttype_str &&
(virttype = virDomainVirtTypeFromString(virttype_str)) < 0) {
virReportError(VIR_ERR_INVALID_ARG,
......@@ -18803,6 +18797,13 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
machine = virQEMUCapsGetDefaultMachine(qemuCaps);
}
if (virttype == VIR_DOMAIN_VIRT_NONE) {
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
virttype = VIR_DOMAIN_VIRT_KVM;
else
virttype = VIR_DOMAIN_VIRT_QEMU;
}
if (!(domCaps = virDomainCapsNew(emulatorbin, machine, arch, virttype)))
goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册