]> git.proxmox.com Git - qemu.git/blobdiff - migration-exec.c
scsi: fix incorrect ?: use
[qemu.git] / migration-exec.c
index e472979d8d3ea9744f96e7c556f91daa0cfda850..87f645b68cc2288d67fb8032b08e9f6e9634be2d 100644 (file)
@@ -52,9 +52,12 @@ static int exec_close(FdMigrationState *s)
     return 0;
 }
 
-MigrationState *exec_start_outgoing_migration(const char *command,
-                                             int64_t bandwidth_limit,
-                                             int detach)
+MigrationState *exec_start_outgoing_migration(Monitor *mon,
+                                              const char *command,
+                                             int64_t bandwidth_limit,
+                                             int detach,
+                                             int blk,
+                                             int inc)
 {
     FdMigrationState *s;
     FILE *f;
@@ -73,10 +76,7 @@ MigrationState *exec_start_outgoing_migration(const char *command,
         goto err_after_open;
     }
 
-    if (fcntl(s->fd, F_SETFD, O_NONBLOCK) == -1) {
-        dprintf("Unable to set nonblocking mode on file descriptor\n");
-        goto err_after_open;
-    }
+    socket_set_nonblock(s->fd);
 
     s->opaque = qemu_popen(f, "w");
 
@@ -87,12 +87,16 @@ MigrationState *exec_start_outgoing_migration(const char *command,
     s->mig_state.get_status = migrate_fd_get_status;
     s->mig_state.release = migrate_fd_release;
 
+    s->mig_state.blk = blk;
+    s->mig_state.shared = inc;
+
     s->state = MIG_STATE_ACTIVE;
-    s->mon_resume = NULL;
+    s->mon = NULL;
     s->bandwidth_limit = bandwidth_limit;
 
-    if (!detach)
-        migrate_fd_monitor_suspend(s);
+    if (!detach) {
+        migrate_fd_monitor_suspend(s, mon);
+    }
 
     migrate_fd_connect(s);
     return &s->mig_state;
@@ -117,7 +121,9 @@ static void exec_accept_incoming_migration(void *opaque)
     qemu_announce_self();
     dprintf("successfully loaded vm state\n");
     /* we've successfully migrated, close the fd */
-    qemu_set_fd_handler2(qemu_popen_fd(f), NULL, NULL, NULL, NULL);
+    qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL);
+    if (autostart)
+        vm_start();
 
 err:
     qemu_fclose(f);
@@ -134,7 +140,7 @@ int exec_start_incoming_migration(const char *command)
         return -errno;
     }
 
-    qemu_set_fd_handler2(qemu_popen_fd(f), NULL,
+    qemu_set_fd_handler2(qemu_stdio_fd(f), NULL,
                         exec_accept_incoming_migration, NULL,
                         (void *)(unsigned long)f);