[libvirt] [PATCH 1/2] qemu: Don't strictly require JSON monitor for vCPU detection

Peter Krempa pkrempa at redhat.com
Mon Oct 3 11:32:46 UTC 2016


Attaching to a existing qemu process allows to get us into a situation
when qemu is new enough to have JSON monitor and new vCPU hotplug but
the json monitor is not used. The vCPU detection code would require it
though. This broke attaching to qemu processes.

Make the condition less strict and just skip the vCPU hotplug detection
if JSON monitor is not available.

Resolves one of the symptoms in:
https://bugzilla.redhat.com/show_bug.cgi?id=1378401
---
 src/qemu/qemu_monitor.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 8083a36..5175f4e 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1898,14 +1898,14 @@ qemuMonitorGetCPUInfo(qemuMonitorPtr mon,
     int rc;
     qemuMonitorCPUInfoPtr info = NULL;

-    if (hotplug)
-        QEMU_CHECK_MONITOR_JSON(mon);
-    else
-        QEMU_CHECK_MONITOR(mon);
+    QEMU_CHECK_MONITOR(mon);

     if (VIR_ALLOC_N(info, maxvcpus) < 0)
         return -1;

+    if (!mon->json)
+        hotplug = false;
+
     /* initialize a few non-zero defaults */
     qemuMonitorCPUInfoClear(info, maxvcpus);

-- 
2.10.0




More information about the libvir-list mailing list