Skip to contentSkip to conversation

Avoid permanently disabled QEMU monitor when UNIX migration fails

PATCH In review Daniel P. Berrange 1 participant 2 messages Dec 11, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Avoid permanently disabled QEMU monitor when UNIX migration fails

If a UNIX migration command is attempt to a UNIX socket which does not exist, then the monitor is suspended, but never resumed. This prevents any further use of the monitor

* migration-unix.c: Only call migrate_fd_monitor_suspend() once connected to the UNIX socket.

---
 migration-unix.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
migration-unix.c +7 -5
index 783228b..a141dbb 100644
@@ -112,10 +112,6 @@ MigrationState *unix_start_outgoing_migration(Monitor *mon,
 
     socket_set_nonblock(s->fd);
 
-    if (!detach) {
-        migrate_fd_monitor_suspend(s, mon);
-    }
-
     do {
         ret = connect(s->fd, (struct sockaddr *)&addr, sizeof(addr));
         if (ret == -1)
@@ -128,7 +124,13 @@ MigrationState *unix_start_outgoing_migration(Monitor *mon,
     if (ret < 0 && ret != -EINPROGRESS && ret != -EWOULDBLOCK) {
         dprintf("connect failed\n");
         goto err_after_open;
-    } else if (ret >= 0)
+    }
+
+    if (!detach) {
+        migrate_fd_monitor_suspend(s, mon);
+    }
+
+    if (ret >= 0)
         migrate_fd_connect(s);
 
     return &s->mig_state;
Signature · 1 line
1.6.5.2
#1 lore raw
Quoted 6 lines · Daniel P. Berrange

If a UNIX migration command is attempt to a UNIX socket which does not exist, then the monitor is suspended, but never resumed. This prevents any further use of the monitor

* migration-unix.c: Only call migrate_fd_monitor_suspend() once connected to the UNIX socket.

Sorry, forgot to include the signed-off tag with this patch, so will resend.

FYI, the test case here is simply

(qemu) migrate unix:/tmp/doesnotexist
migration failed
...now hung, no prompt returns..

There is also similar kind of problem with exec migration, but I have not been able to figure out where the problem lies for that one. I suspect something is not dealing with errors properly in the buffered file code. If someone fancies investigating the exec: issue, the test case is simply to run exec with a command that fails, eg give invalid syntax for one of its args. I discovered the problem when i did a simple typo with dd

(qemu) migrate "exec:dd bs-1m of=/tmp/file"
dd: unrecognized operand `bs-1m'
Try `dd --help' for more information.
...now hung, no prompt returns..

Regards,
Daniel

Signature · 4 lines
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|