[libvirt] [PATCH 02/20] Wait to receive QMP greeting before sending any monitor commands

Eric Blake eblake at redhat.com
Tue Sep 11 23:40:04 UTC 2012


On 09/11/2012 05:34 PM, Eric Blake wrote:
>>> soon after startup. Waiting for the QMP greeting avoids the
>>> race
>>>

> 
> Spoke too soon. This makes the testsuite hang in qemumonitorjsontest, as
> the fake json monitor never manages to trigger the wait_greeting reset
> to 0.  I'm not sure how best to fix the infloop, but that is needed
> before this patch can go in.

My down-and-dirty hack:

diff --git i/src/qemu/qemu_monitor.c w/src/qemu/qemu_monitor.c
index fb67b9a..157d58f 100644
--- i/src/qemu/qemu_monitor.c
+++ w/src/qemu/qemu_monitor.c
@@ -720,8 +720,8 @@ qemuMonitorOpen(virDomainObjPtr vm,
     }
     mon->fd = -1;
     mon->vm = vm;
-    mon->json = json;
-    if (json)
+    mon->json = !!json;
+    if (json == 1)
         mon->wait_greeting = 1;
     mon->cb = cb;
     qemuMonitorLock(mon);
diff --git i/tests/qemumonitortestutils.c w/tests/qemumonitortestutils.c
index 76b11e6..3e7285f 100644
--- i/tests/qemumonitortestutils.c
+++ w/tests/qemumonitortestutils.c
@@ -458,7 +458,7 @@ qemuMonitorTestPtr qemuMonitorTestNew(bool json,
virCapsPtr caps)

     if (!(test->mon = qemuMonitorOpen(test->vm,
                                       &src,
-                                      true,
+                                      2,
                                       &qemuCallbacks)))
         goto error;
     qemuMonitorLock(test->mon);


-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120911/48e52fb3/attachment-0001.sig>


More information about the libvir-list mailing list