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

[libvirt] [PATCH] qemu: Correctly wait for spice to migrate

Currently we query-spice after the main migration has completed
before moving to next state. Qemu reports this as boolean (not
enclosed within quotes). Therefore it is not correct to use
virJSONValueObjectGetString but virJSONValueObjectGetBoolean instead.

Meanwhile, this is does no harm for now, since we fail to set
QEMU_CAPS_SEAMLESS_MIGRATION as we use querying capabilities on
the QMP monitor where 'seamless-migration=[on|off]' cmd line
option is not advertised. However, on some distros where we still
compute capabilities by parsing '-help' output we fail.

 src/qemu/qemu_monitor_json.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 2daf8ea..8087e4f 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2399,7 +2399,6 @@ qemuMonitorJSONSpiceGetMigrationStatusReply(virJSONValuePtr reply,
                                             bool *spice_migrated)
     virJSONValuePtr ret;
-    const char *migrated_str;
     if (!(ret = virJSONValueObjectGet(reply, "return"))) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -2407,13 +2406,11 @@ qemuMonitorJSONSpiceGetMigrationStatusReply(virJSONValuePtr reply,
         return -1;
-    if (!(migrated_str = virJSONValueObjectGetString(ret, "migrated"))) {
+    if (virJSONValueObjectGetBoolean(ret, "migrated", spice_migrated) < 0) {
         /* Deliberately don't report error here as we are
          * probably dealing with older qemu which doesn't
          * report this yet. Pretend spice is migrated. */
         *spice_migrated = true;
-    } else {
-        *spice_migrated = STREQ(migrated_str, "true");
     return 0;

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