[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] Fix bogus reporting of KVM support for non-native emulators



From: "Daniel P. Berrange" <berrange redhat com>

A logic bug meant we reported KVM was possible for every
architecture, merely based on whether the query-kvm command
exists. We should instead have been doing it based on whether
the query-kvm command returns 'present: 1'

Signed-off-by: Daniel P. Berrange <berrange redhat com>
---
 src/qemu/qemu_capabilities.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index f86c28f..29693c3 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2117,11 +2117,16 @@ qemuCapsProbeQMPKVMState(qemuCapsPtr caps,
         return -1;
 
     /* The QEMU_CAPS_KVM flag was initially set according to the QEMU
-     * reporting the recognition of 'query-kvm' QMP command, but the
-     * flag means whether the KVM is enabled by default and should be
-     * disabled in case we want SW emulated machine, so let's fix that
-     * if it's true. */
-    if (!enabled) {
+     * reporting the recognition of 'query-kvm' QMP command. That merely
+     * indicates existance of the command though, not whether KVM support
+     * is actually available, nor whether it is enabled by default.
+     *
+     * If it is not present we need to clear the flag, and if it is
+     * not enabled by default we need to change the flag.
+     */
+    if (!present) {
+        qemuCapsClear(caps, QEMU_CAPS_KVM);
+    } else if (!enabled) {
         qemuCapsClear(caps, QEMU_CAPS_KVM);
         qemuCapsSet(caps, QEMU_CAPS_ENABLE_KVM);
     }
-- 
1.8.0.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]