Patchwork Avoid permanently disabled QEMU monitor when UNIX migration fails

login
register
mail settings
Submitter Daniel P. Berrange
Date Dec. 11, 2009, 9:01 p.m.
Message ID <1260565274-28116-1-git-send-email-berrange@redhat.com>
Download mbox | patch
Permalink /patch/40927/
State New
Headers show

Comments

Daniel P. Berrange - Dec. 11, 2009, 9:01 p.m.
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.

   Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 migration-unix.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

Patch

diff --git a/migration-unix.c b/migration-unix.c
index 783228b..a141dbb 100644
--- a/migration-unix.c
+++ b/migration-unix.c
@@ -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;