[PATCH v2 04/31] qemucapsprobe: Ignore all greetings except the first one

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

 



When starting QEMU more than once during a single probing process,
qemucapsprobe utility would save QMP greeting several times, which
doesn't play well with our test monitor.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 tests/qemucapsprobemock.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/qemucapsprobemock.c b/tests/qemucapsprobemock.c
index 0c4c786..bad69bb 100644
--- a/tests/qemucapsprobemock.c
+++ b/tests/qemucapsprobemock.c
@@ -77,10 +77,14 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon,
         char *p;
         bool skip = false;
 
-        if (first)
+        if (first) {
             first = false;
-        else
+        } else {
+            /* Ignore QMP greeting if it's not the first one */
+            if (virJSONValueObjectHasKey(value, "QMP"))
+                goto cleanup;
             putchar('\n');
+        }
 
         for (p = json; *p; p++) {
             if (skip && *p == '\n') {
@@ -92,6 +96,7 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon,
         }
     }
 
+ cleanup:
     VIR_FREE(json);
     virJSONValueFree(value);
     return ret;
-- 
2.10.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux