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

Eric Blake eblake at redhat.com
Wed Sep 12 18:50:09 UTC 2012


On 09/12/2012 10:37 AM, Daniel P. Berrange wrote:
>> 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.
> 
> Oh, the fix is to actually send the expected greeting, as a normal QEMU
> would :-)

Yep, much nicer than my hack.  (Although my hack points out that
tests/qemumonitortestutils.c is passing 'true' to an 'int' parameter of
qemuMonitorOpen(), so that's still worth tweaking, by either making
qemuMonitorOpen() take a bool, or by fixing the test to pass 1...)

Except that it failed to compile:

  CC     libqemumonitortestutils_la-qemumonitortestutils.lo
qemumonitortestutils.c:422:82: error: missing terminating " character
[-Werror]
qemumonitortestutils.c: In function 'qemuMonitorTestNew':
qemumonitortestutils.c:475:35: error: expected ':' before 'QEMU'
qemumonitortestutils.c:475:35: error: multi-character character constant
[-Werror=multichar]
qemumonitortestutils.c:475:35: error: missing terminating " character

> 
> The following patch prevents a hang in the test suite for me. Can you
> confirm:

Confirmed.  ACK to the original patch + your changes + this squashed in:

diff --git i/tests/qemumonitortestutils.c w/tests/qemumonitortestutils.c
index 854fb7a..57adbaf 100644
--- i/tests/qemumonitortestutils.c
+++ w/tests/qemumonitortestutils.c
@@ -418,8 +418,11 @@ static qemuMonitorCallbacks qemuCallbacks = {
     .errorNotify = qemuMonitorTestErrorNotify,
 };

-#define QEMU_JSON_GREETING "{\"QMP\": {\"version\": {\"qemu\":
{\"micro\": 1, \"minor\": 0, \"major\": 1}, \"package\": \"
(qemu-kvm-1.0.1)\"}, \"capabilities\
-#define QEMU_TEXT_GREETING "QEMU 1.0,1 monitor - type 'help' for more
information"
+#define QEMU_JSON_GREETING "{\"QMP\": {\"version\": {\"qemu\": "        \
+    "{\"micro\": 1, \"minor\": 0, \"major\": 1}, "                      \
+    "\"package\": \" (qemu-kvm-1.0.1)\"}, \"capabilities\": []}}"
+#define QEMU_TEXT_GREETING \
+    "QEMU 1.0,1 monitor - type 'help' for more information"

 qemuMonitorTestPtr qemuMonitorTestNew(bool json, virCapsPtr caps)
 {
@@ -461,7 +464,7 @@ qemuMonitorTestPtr qemuMonitorTestNew(bool json,
virCapsPtr caps)

     if (!(test->mon = qemuMonitorOpen(test->vm,
                                       &src,
-                                      true,
+                                      1,
                                       &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/20120912/175877c7/attachment-0001.sig>


More information about the libvir-list mailing list