[libvirt] [PATCH v2 08/31] qemu: Don't return unusable virttype in domain capabilities

Jiri Denemark jdenemar at redhat.com
Sun Nov 20 23:21:04 UTC 2016


If a user asked for a KVM domain capabilities when KVM is not available,
we would happily return data we got when probing through TCG and
pretended they were relevant for KVM. Let's just report KVM is not
supported to avoid confusion.

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 src/qemu/qemu_driver.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 925631b..09a8d06 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18811,6 +18811,13 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
     if (virttype == VIR_DOMAIN_VIRT_NONE)
         virttype = capsType;
 
+    if (virttype == VIR_DOMAIN_VIRT_KVM && capsType == VIR_DOMAIN_VIRT_QEMU) {
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("KVM is not supported by '%s' on this host"),
+                       emulatorbin);
+        goto cleanup;
+    }
+
     if (!(domCaps = virDomainCapsNew(emulatorbin, machine, arch, virttype)))
         goto cleanup;
 
-- 
2.10.2




More information about the libvir-list mailing list