qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org
Cc: quintela@redhat.com, liang.z.li@intel.com, amit.shah@redhat.com,
	pbonzini@redhat.com
Subject: [Qemu-devel] [PATCH 2/3] Add migrate -u option for -incoming pause
Date: Tue, 10 Feb 2015 16:16:38 +0000	[thread overview]
Message-ID: <1423584999-13946-3-git-send-email-dgilbert@redhat.com> (raw)
In-Reply-To: <1423584999-13946-1-git-send-email-dgilbert@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Once a qemu has been started with -incoming pause   the
migration can be started by issuing:

migrate -u uri

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 hmp-commands.hx       | 11 +++++++----
 hmp.c                 |  6 ++++--
 migration/migration.c | 21 ++++++++++++++++++++-
 qapi-schema.json      |  5 ++++-
 qmp-commands.hx       |  3 ++-
 5 files changed, 37 insertions(+), 9 deletions(-)

diff --git a/hmp-commands.hx b/hmp-commands.hx
index e37bc8b..45f293a 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -887,23 +887,26 @@ ETEXI
 
     {
         .name       = "migrate",
-        .args_type  = "detach:-d,blk:-b,inc:-i,uri:s",
-        .params     = "[-d] [-b] [-i] uri",
+        .args_type  = "detach:-d,blk:-b,inc:-i,unpause:-u,uri:s",
+        .params     = "[-d] [-b] [-i] [-u] uri",
         .help       = "migrate to URI (using -d to not wait for completion)"
 		      "\n\t\t\t -b for migration without shared storage with"
 		      " full copy of disk\n\t\t\t -i for migration without "
 		      "shared storage with incremental copy of disk "
-		      "(base image shared between src and destination)",
+		      "(base image shared between src and destination)"
+                      "\n\t\t\t -u unpauses an incoming migration started with "
+                      "-incoming pause using the given uri.",
         .mhandler.cmd = hmp_migrate,
     },
 
 
 STEXI
-@item migrate [-d] [-b] [-i] @var{uri}
+@item migrate [-d] [-b] [-i] [-u] @var{uri}
 @findex migrate
 Migrate to @var{uri} (using -d to not wait for completion).
 	-b for migration with full copy of disk
 	-i for migration with incremental copy of disk (base image is shared)
+        -u to unpause an incoming migration started with -incoming pause
 ETEXI
 
     {
diff --git a/hmp.c b/hmp.c
index b47f331..fb0cde1 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1344,17 +1344,19 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
     int detach = qdict_get_try_bool(qdict, "detach", 0);
     int blk = qdict_get_try_bool(qdict, "blk", 0);
     int inc = qdict_get_try_bool(qdict, "inc", 0);
+    int unpause = qdict_get_try_bool(qdict, "unpause", 0);
     const char *uri = qdict_get_str(qdict, "uri");
     Error *err = NULL;
 
-    qmp_migrate(uri, !!blk, blk, !!inc, inc, false, false, &err);
+    qmp_migrate(uri, !!blk, blk, !!inc, inc, false, false, !!unpause, unpause,
+                &err);
     if (err) {
         monitor_printf(mon, "migrate: %s\n", error_get_pretty(err));
         error_free(err);
         return;
     }
 
-    if (!detach) {
+    if (!detach && !unpause) {
         MigrationStatus *status;
 
         if (monitor_suspend(mon) < 0) {
diff --git a/migration/migration.c b/migration/migration.c
index 77263a5..2308067 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -434,7 +434,7 @@ void migrate_del_blocker(Error *reason)
 
 void qmp_migrate(const char *uri, bool has_blk, bool blk,
                  bool has_inc, bool inc, bool has_detach, bool detach,
-                 Error **errp)
+                 bool has_unpause, bool unpause, Error **errp)
 {
     Error *local_err = NULL;
     MigrationState *s = migrate_get_current();
@@ -450,6 +450,25 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
         return;
     }
 
+    if (unpause) {
+        /* Unpause is starting up an *incoming* migration */
+        if (detach || inc || blk) {
+            error_setg(errp, "Other flags are not meaningful for unpause");
+            return;
+        }
+
+        if (!paused_incoming) {
+            error_setg(errp, "Unpause can only be used with -incoming pause");
+            return;
+        }
+
+        qemu_start_incoming_migration(uri, errp);
+        if (!errp || !*errp) {
+            paused_incoming = false;
+        }
+        return;
+    }
+
     if (runstate_check(RUN_STATE_INMIGRATE)) {
         error_setg(errp, "Guest is waiting for an incoming migration");
         return;
diff --git a/qapi-schema.json b/qapi-schema.json
index e16f8eb..8dd0b88 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1731,12 +1731,15 @@
 # @detach: this argument exists only for compatibility reasons and
 #          is ignored by QEMU
 #
+# @unpause: Start an inward migration initiated with -incoming pause
+#
 # Returns: nothing on success
 #
 # Since: 0.14.0
 ##
 { 'command': 'migrate',
-  'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', '*detach': 'bool' } }
+  'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', '*detach': 'bool',
+           '*unpause': 'bool' } }
 
 # @xen-save-devices-state:
 #
diff --git a/qmp-commands.hx b/qmp-commands.hx
index a85d847..76673c5 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -610,7 +610,7 @@ EQMP
 
     {
         .name       = "migrate",
-        .args_type  = "detach:-d,blk:-b,inc:-i,uri:s",
+        .args_type  = "detach:-d,blk:-b,inc:-i,unpause:-u,uri:s",
         .mhandler.cmd_new = qmp_marshal_input_migrate,
     },
 
@@ -624,6 +624,7 @@ Arguments:
 
 - "blk": block migration, full disk copy (json-bool, optional)
 - "inc": incremental disk copy (json-bool, optional)
+- "unpause": Unpause an incoming migration (json-bool, optional)
 - "uri": Destination URI (json-string)
 
 Example:
-- 
2.1.0

  parent reply	other threads:[~2015-02-10 16:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-10 16:16 [Qemu-devel] [PATCH 0/3] -incoming pause Dr. David Alan Gilbert (git)
2015-02-10 16:16 ` [Qemu-devel] [PATCH 1/3] Add " Dr. David Alan Gilbert (git)
2015-02-10 16:42   ` Juan Quintela
2015-02-10 16:16 ` Dr. David Alan Gilbert (git) [this message]
2015-02-10 16:47   ` [Qemu-devel] [PATCH 2/3] Add migrate -u option for " Daniel P. Berrange
2015-02-10 16:57     ` Eric Blake
2015-02-11 16:48       ` Dr. David Alan Gilbert
2015-02-11 17:10         ` Eric Blake
2015-02-10 16:59     ` Dr. David Alan Gilbert
2015-02-10 17:00   ` Juan Quintela
2015-02-11 16:53     ` Dr. David Alan Gilbert
2015-02-10 16:16 ` [Qemu-devel] [PATCH 3/3] Document -incoming options Dr. David Alan Gilbert (git)
2015-02-10 17:00   ` Juan Quintela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1423584999-13946-3-git-send-email-dgilbert@redhat.com \
    --to=dgilbert@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=liang.z.li@intel.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).