Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MoSOG-0005QZ-VE for qemu-devel@nongnu.org; Thu, 17 Sep 2009 21:36:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MoSOB-0005QN-Ef for qemu-devel@nongnu.org; Thu, 17 Sep 2009 21:35:59 -0400 Received: from [199.232.76.173] (port=42764 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MoSOB-0005QK-8k for qemu-devel@nongnu.org; Thu, 17 Sep 2009 21:35:55 -0400 Received: from smarthost.c4l.co.uk ([82.197.83.77]:33942) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MoSOA-0000hI-Sh for qemu-devel@nongnu.org; Thu, 17 Sep 2009 21:35:55 -0400 Received: from [93.97.162.229] (helo=mx.parenthephobia.org.uk) by smarthost.c4l.co.uk with esmtp (Exim 4.69) (envelope-from ) id 1MoSOS-0002lB-CA for qemu-devel@nongnu.org; Fri, 18 Sep 2009 02:36:12 +0100 Received: from [IPv6:2001:9d8:fade:2:221:97ff:fe9c:5fa4] (unknown [IPv6:2001:9d8:fade:2:221:97ff:fe9c:5fa4]) (Authenticated sender: nathan) by mx.parenthephobia.org.uk (Postfix) with ESMTPA id D8FFB53190 for ; Fri, 18 Sep 2009 02:35:48 +0100 (BST) From: Nathan Baum Content-Type: multipart/mixed; boundary="=-oNkfscp+BXtuV5XPY0QV" Date: Fri, 18 Sep 2009 02:36:26 +0100 Message-Id: <1253237786.7425.145.camel@athens.parenthephobia.org.uk> Mime-Version: 1.0 Subject: [Qemu-devel] [PATCH] Option to continue after migration List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --=-oNkfscp+BXtuV5XPY0QV Content-Type: text/plain Content-Transfer-Encoding: 7bit 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 --=-oNkfscp+BXtuV5XPY0QV Content-Disposition: attachment; filename="continue-after-migration.patch" Content-Type: text/x-patch; name="continue-after-migration.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit 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, --=-oNkfscp+BXtuV5XPY0QV--