qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Option to continue after migration
@ 2009-09-18  1:36 Nathan Baum
  2009-09-18  1:52 ` Jamie Lokier
  2009-09-30 13:46 ` [Qemu-devel] [PATCH] " Anthony Liguori
  0 siblings, 2 replies; 5+ messages in thread
From: Nathan Baum @ 2009-09-18  1:36 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 446 bytes --]

Hello,

This patch adds a -c "continue" option to the migrate command which
causes the originating VM to remain running after migration, assuming it
was running before.

I've done this primarily so that I can do "migrate -d -c exec:cat>file"
to take a snapshot without needing to have a snapshot-capable drive
attached, or wait until migration is complete and continue the VM
manually.

Signed-off-by: Nathan Baum <nathan@parenthephobia.org.uk>


[-- Attachment #2: continue-after-migration.patch --]
[-- Type: text/x-patch, Size: 1860 bytes --]

diff --git a/migration.c b/migration.c
index 7f93e3f..9536098 100644
--- a/migration.c
+++ b/migration.c
@@ -72,6 +72,7 @@ void do_migrate(Monitor *mon, const QDict *qdict)
     else
         monitor_printf(mon, "unknown migration protocol: %s\n", uri);
 
+    s->stop_at_end = !qdict_get_int(qdict, "continue");
     if (s == NULL)
         monitor_printf(mon, "migration failed\n");
     else {
@@ -287,6 +288,9 @@ void migrate_fd_put_ready(void *opaque)
             state = MIG_STATE_ERROR;
         } else {
             state = MIG_STATE_COMPLETED;
+	    if (!s->mig_state.stop_at_end && old_vm_running) {
+	      vm_start();
+	    }
         }
         migrate_fd_cleanup(s);
         s->state = state;
diff --git a/migration.h b/migration.h
index 53b923d..ea2610b 100644
--- a/migration.h
+++ b/migration.h
@@ -26,6 +26,7 @@ typedef struct MigrationState MigrationState;
 
 struct MigrationState
 {
+    int stop_at_end;
     /* FIXME: add more accessors to print migration info */
     void (*cancel)(MigrationState *s);
     int (*get_status)(MigrationState *s);
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index 9f91873..168fe8c 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -466,11 +466,13 @@ STEXI
 Inject an NMI on the given CPU (x86 only).
 ETEXI
 
-    { "migrate", "detach:-d,uri:s", do_migrate,
-      "[-d] uri", "migrate to URI (using -d to not wait for completion)" },
+    { "migrate", "detach:-d,continue:-c,uri:s", do_migrate,
+      "[-d] [-c] uri", "migrate to URI (using -d to migrate in background, and"
+                       " -c to not stop this VM afterward)" },
 STEXI
 @item migrate [-d] @var{uri}
-Migrate to @var{uri} (using -d to not wait for completion).
+Migrate to @var{uri} (using -d to migrate in background, and -c to not stop
+this VM afterward).
 ETEXI
 
     { "migrate_cancel", "", do_migrate_cancel,

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-09-30 13:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-18  1:36 [Qemu-devel] [PATCH] Option to continue after migration Nathan Baum
2009-09-18  1:52 ` Jamie Lokier
2009-09-18  7:42   ` [Qemu-devel] [RFC][PATCH] " Nathan Baum
2009-09-18  8:17     ` [Qemu-devel] " Jan Kiszka
2009-09-30 13:46 ` [Qemu-devel] [PATCH] " Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).