On Mon, Nov 21, 2016 at 12:21:03AM +0100, Jiri Denemark wrote:
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: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_driver.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d039255..925631b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18723,7 +18723,8 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
char *ret = NULL;
virQEMUDriverPtr driver = conn->privateData;
virQEMUCapsPtr qemuCaps = NULL;
- int virttype; /* virDomainVirtType */
+ int virttype = VIR_DOMAIN_VIRT_NONE;
+ virDomainVirtType capsType;
virDomainCapsPtr domCaps = NULL;
int arch = virArchFromHost(); /* virArch */
virQEMUDriverConfigPtr cfg = NULL;
@@ -18739,12 +18740,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,
@@ -18808,6 +18803,14 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
machine = virQEMUCapsGetDefaultMachine(qemuCaps);
}
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
+ capsType = VIR_DOMAIN_VIRT_KVM;
+ else
+ capsType = VIR_DOMAIN_VIRT_QEMU;
+
+ if (virttype == VIR_DOMAIN_VIRT_NONE)
+ virttype = capsType;
There is no need for the *capsType* variable, just move the
"if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) ..." here and virttype can be set
directly.
ACK with that fixed.
Pavel
+
if (!(domCaps = virDomainCapsNew(emulatorbin, machine, arch, virttype)))
goto cleanup;
--
2.10.2
--
libvir-list mailing list
libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list