As of version 2.10, QEMU can be built without the TCG. When libvirt determines 
that capabilities of a QEMU binary using QMP, it launches a QEMU process with 
KVM acceleration and TCG as a fallback. If QEMU supports KVM, a second probe is 
performed, forcing QEMU to use only TCG. This causes an error if the QEMU 
binary was built without TCG. This patch allows execution to continue when the 
second probe fails. Thus libvirt can be used with QEMU built without TCG. First 
patch. Feedback appreciated. If better solution, please advise.

Signed-off-by: Tobin Feldman-Fitzthum <to...@linux.vnet.ibm.com>
---
 src/qemu/qemu_capabilities.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index a95a60c36a..f303171cc4 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5100,9 +5100,6 @@ virQEMUCapsInitQMPSingle(virQEMUCapsPtr qemuCaps,
         ret = virQEMUCapsInitQMPMonitor(qemuCaps, proc->mon);
 
  cleanup:
-    if (ret < 0)
-        virQEMUCapsLogProbeFailure(qemuCaps->binary);
-
     qemuProcessQMPFree(proc);
     return ret;
 }
@@ -5114,17 +5111,18 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
                    uid_t runUid,
                    gid_t runGid)
 {
-    if (virQEMUCapsInitQMPSingle(qemuCaps, libDir, runUid, runGid, false) < 0)
+    if (virQEMUCapsInitQMPSingle(qemuCaps, libDir, runUid, runGid, false) < 0) 
{
+        virQEMUCapsLogProbeFailure(qemuCaps->binary);
         return -1;
+    }
 
     /*
      * If KVM was enabled during the first probe, we need to explicitly probe
      * for TCG capabilities by asking the same binary again and turning KVM
      * off.
      */
-    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM) &&
-        virQEMUCapsInitQMPSingle(qemuCaps, libDir, runUid, runGid, true) < 0)
-        return -1;
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
+        virQEMUCapsInitQMPSingle(qemuCaps, libDir, runUid, runGid, true);
 
     return 0;
 }
-- 
2.20.1 (Apple Git-117)


Reply via email to