]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Propagate QEMU errors during incoming migrations
authorJiri Denemark <jdenemar@redhat.com>
Fri, 5 Sep 2014 23:16:20 +0000 (01:16 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 8 Sep 2014 11:33:44 +0000 (13:33 +0200)
When QEMU fails during incoming migration after we successfully started
it (i.e., during Perform or Finish phase), we report a rather unhelpful
message

    Unable to read from monitor: Connection reset by peer

We already have a code that takes error messages from QEMU's error
output but we disable it once QEMU successfully starts. This patch
postpones this until the end of Finish phase during incoming migration
so that we can report a much better error message:

    internal error: early end of file from monitor: possible problem:
    Unknown savevm section or instance '0000:00:05.0/virtio-balloon' 0
    load of migration failed

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

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

index f2b421eaef17c15898e351f564d0fc3abfcee6c7..64f0d8df1c89e2ba830caf4f04a08c8973986909 100644 (file)
@@ -4689,6 +4689,8 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
  cleanup:
     virPortAllocatorRelease(driver->migrationPorts, port);
     if (vm) {
+        if (priv->mon)
+            qemuMonitorSetDomainLog(priv->mon, -1);
         VIR_FREE(priv->origname);
         virObjectUnlock(vm);
     }
index d96b1b80cf7a2d2813524c58c7fc02e05478807e..702404a0ec1d5ecfc94e12075a1f8b7802762cd0 100644 (file)
@@ -631,8 +631,11 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque)
         error = true;
     } else {
         if (events & VIR_EVENT_HANDLE_WRITABLE) {
-            if (qemuMonitorIOWrite(mon) < 0)
+            if (qemuMonitorIOWrite(mon) < 0) {
                 error = true;
+                if (errno == ECONNRESET)
+                    hangup = true;
+            }
             events &= ~VIR_EVENT_HANDLE_WRITABLE;
         }
 
@@ -642,6 +645,8 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque)
             events &= ~VIR_EVENT_HANDLE_READABLE;
             if (got < 0) {
                 error = true;
+                if (errno == ECONNRESET)
+                    hangup = true;
             } else if (got == 0) {
                 eof = true;
             } else {
@@ -683,8 +688,9 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque)
         if (hangup) {
             /* Check if an error message from qemu is available and if so, use
              * it to overwrite the actual message. It's done only in early
-             * startup phases where the message from qemu is certainly more
-             * interesting than a "connection reset by peer" message.
+             * startup phases or during incoming migration when the message
+             * from qemu is certainly more interesting than a
+             * "connection reset by peer" message.
              */
             char *qemuMessage;
 
index 38ed3fee631f41da6e4e853eaa73c4dab19f728d..b1d8a324dd3866bfa43eb1932ed3d77124256ead 100644 (file)
@@ -4379,8 +4379,10 @@ int qemuProcessStart(virConnectPtr conn,
             goto cleanup;
     }
 
-    /* unset reporting errors from qemu log */
-    qemuMonitorSetDomainLog(priv->mon, -1);
+    /* Keep watching qemu log for errors during incoming migration, otherwise
+     * unset reporting errors from qemu log. */
+    if (!migrateFrom)
+        qemuMonitorSetDomainLog(priv->mon, -1);
 
     virCommandFree(cmd);
     VIR_FORCE_CLOSE(logfile);