]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Don't use query-migrate on destination
authorJiri Denemark <jdenemar@redhat.com>
Mon, 12 Sep 2016 08:24:21 +0000 (10:24 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 12 Sep 2016 13:56:10 +0000 (15:56 +0200)
When migration fails, we need to poke QEMU monitor to check for a reason
of the failure. We did this using query-migrate QMP command, which is
not supposed to return any meaningful result on the destination side.
Thus if the monitor was still functional when we detected the migration
failure, parsing the answer from query-migrate always failed with the
following error message:

    "info migration reply was missing return status"

This irrelevant message was then used as the reason for the migration
failure replacing any message we might have had.

Let's use harmless query-status for poking the monitor to make sure we
only get an error if the monitor connection is broken.

https://bugzilla.redhat.com/show_bug.cgi?id=1374613

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_domain.c
src/qemu/qemu_domain.h
src/qemu/qemu_migration.c
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h

index fd79390a7ae9be34ba52c28b583a25b9b2fe9e56..fb766d077663277524093906b8c30e782f276163 100644 (file)
@@ -6127,3 +6127,23 @@ qemuDomainVcpuPersistOrder(virDomainDefPtr def)
         }
     }
 }
+
+
+int
+qemuDomainCheckMonitor(virQEMUDriverPtr driver,
+                       virDomainObjPtr vm,
+                       qemuDomainAsyncJob asyncJob)
+{
+    qemuDomainObjPrivatePtr priv = vm->privateData;
+    int ret;
+
+    if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
+        return -1;
+
+    ret = qemuMonitorCheck(priv->mon);
+
+    if (qemuDomainObjExitMonitor(driver, vm) < 0)
+        return -1;
+
+    return ret;
+}
index 13c03729f3cd5664563eddc6a3ab1401cdacc091..a1404d037825be9b6dae75e6e7e02189acde4170 100644 (file)
@@ -728,4 +728,8 @@ bool qemuDomainVcpuHotplugIsInOrder(virDomainDefPtr def)
 void qemuDomainVcpuPersistOrder(virDomainDefPtr def)
     ATTRIBUTE_NONNULL(1);
 
+int qemuDomainCheckMonitor(virQEMUDriverPtr driver,
+                           virDomainObjPtr vm,
+                           qemuDomainAsyncJob asyncJob);
+
 #endif /* __QEMU_DOMAIN_H__ */
index 07f18db635cc5de79f25c8fe95baa1e9d37416ac..e734816c4e12e673faf3d52f3715f3a0667ea051 100644 (file)
@@ -6208,14 +6208,10 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
     }
 
     if (retcode != 0) {
-        qemuDomainJobInfo info;
-
         /* Check for a possible error on the monitor in case Finish was called
          * earlier than monitor EOF handler got a chance to process the error
          */
-        qemuMigrationFetchJobStatus(driver, vm,
-                                    QEMU_ASYNC_JOB_MIGRATION_IN,
-                                    &info);
+        qemuDomainCheckMonitor(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN);
         goto endjob;
     }
 
index 4171914a075faa05a8a15ed1eb855952e38c2495..1fdee3a6f4416319b86c77c608ce90033ecedb57 100644 (file)
@@ -1616,6 +1616,14 @@ qemuMonitorStopCPUs(qemuMonitorPtr mon)
 }
 
 
+int
+qemuMonitorCheck(qemuMonitorPtr mon)
+{
+    bool running;
+    return qemuMonitorGetStatus(mon, &running, NULL);
+}
+
+
 int
 qemuMonitorGetStatus(qemuMonitorPtr mon,
                      bool *running,
index b838725d7e0c714929cda4a362bc2a5ed5c49813..255fff2eae9dfc444d82848dc9de1ead1252f303 100644 (file)
@@ -382,6 +382,7 @@ typedef enum {
 VIR_ENUM_DECL(qemuMonitorVMStatus)
 int qemuMonitorVMStatusToPausedReason(const char *status);
 
+int qemuMonitorCheck(qemuMonitorPtr mon);
 int qemuMonitorGetStatus(qemuMonitorPtr mon,
                          bool *running,
                          virDomainPausedReason *reason)