qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Orit Wasserman <owasserm@redhat.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, quintela@redhat.com, stefanha@gmail.com,
	blauwirbel@gmail.com, Orit Wasserman <owasserm@redhat.com>,
	avi@redhat.com
Subject: [Qemu-devel] [PATCH v8 07/10] Add XBZRLE option to migrate command
Date: Thu,  5 Apr 2012 13:47:56 +0300	[thread overview]
Message-ID: <1333622879-12055-8-git-send-email-owasserm@redhat.com> (raw)
In-Reply-To: <1333622879-12055-1-git-send-email-owasserm@redhat.com>

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
---
 hmp-commands.hx  |   20 ++++++++++++--------
 hmp.c            |    4 +++-
 migration.c      |    9 +++++++++
 qapi-schema.json |    2 +-
 qmp-commands.hx  |    4 +++-
 5 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/hmp-commands.hx b/hmp-commands.hx
index bd35a3e..88e345a 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -799,23 +799,27 @@ ETEXI
 
     {
         .name       = "migrate",
-        .args_type  = "detach:-d,blk:-b,inc:-i,uri:s",
-        .params     = "[-d] [-b] [-i] 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)",
+        .args_type  = "detach:-d,blk:-b,inc:-i,xbzrle:-x,uri:s",
+        .params     = "[-d] [-b] [-i] [-x] uri",
+        .help       = "migrate to URI"
+                      "\n\t -d to not wait for completion"
+		      "\n\t -b for migration without shared storage with"
+		      " full copy of disk"
+                      "\n\t -i for migration without"
+                      " shared storage with incremental copy of disk"
+                      " (base image shared between source and destination)"
+                      "\n\t -x to use XBZRLE page delta compression",
         .mhandler.cmd = hmp_migrate,
     },
 
 
 STEXI
-@item migrate [-d] [-b] [-i] @var{uri}
+@item migrate [-d] [-b] [-i] [-x] @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)
+	-x to use XBZRLE page delta compression
 ETEXI
 
     {
diff --git a/hmp.c b/hmp.c
index 9cf2d13..c2f8c31 100644
--- a/hmp.c
+++ b/hmp.c
@@ -907,10 +907,12 @@ 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 xbzrle = qdict_get_try_bool(qdict, "xbzrle", 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, !!xbzrle, xbzrle,
+                &err);
     if (err) {
         monitor_printf(mon, "migrate: %s\n", error_get_pretty(err));
         error_free(err);
diff --git a/migration.c b/migration.c
index 4e2c3b3..66238de 100644
--- a/migration.c
+++ b/migration.c
@@ -43,6 +43,11 @@ enum {
 
 #define MAX_THROTTLE  (32 << 20)      /* Migration speed throttling */
 
+/* Migration XBZRLE cache size */
+#define DEFAULT_MIGRATE_CACHE_SIZE (64 * 1024 * 1024)
+
+static int64_t migrate_cache_size = DEFAULT_MIGRATE_CACHE_SIZE;
+
 static NotifierList migration_state_notifiers =
     NOTIFIER_LIST_INITIALIZER(migration_state_notifiers);
 
@@ -388,6 +393,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,
+                 bool has_xbzrle, bool xbzrle,
                  Error **errp)
 {
     MigrationState *s = migrate_get_current();
@@ -398,6 +404,9 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
     params.blk = blk;
     params.shared = inc;
 
+    params.use_xbzrle = xbzrle;
+    params.xbzrle_cache_size =  migrate_cache_size;
+
     if (s->state == MIG_STATE_ACTIVE) {
         error_set(errp, QERR_MIGRATION_ACTIVE);
         return;
diff --git a/qapi-schema.json b/qapi-schema.json
index 0d11d6e..8b1c78a 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1683,7 +1683,7 @@
 # Since: 0.14.0
 ##
 { 'command': 'migrate',
-  'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', '*detach': 'bool' } }
+  'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', '*detach': 'bool', '*xbzrle': 'bool' } }
 
 # @xen-save-devices-state:
 #
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 9447871..5d3714f 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -472,7 +472,8 @@ EQMP
 
     {
         .name       = "migrate",
-        .args_type  = "detach:-d,blk:-b,inc:-i,uri:s",
+        .args_type  = "detach:-d,blk:-b,inc:-i,xbzrle:-x,uri:s",
+        .params     = "[-d] [-b] [-i] [-x] uri",
         .mhandler.cmd_new = qmp_marshal_input_migrate,
     },
 
@@ -487,6 +488,7 @@ Arguments:
 - "blk": block migration, full disk copy (json-bool, optional)
 - "inc": incremental disk copy (json-bool, optional)
 - "uri": Destination URI (json-string)
+- "xbzrle": to use XBZRLE page delta compression
 
 Example:
 
-- 
1.7.7.6

  parent reply	other threads:[~2012-04-05 11:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-05 10:47 [Qemu-devel] [PATCH v8 00/10] XBZRLE delta for live migration of large memory app Orit Wasserman
2012-04-05 10:47 ` [Qemu-devel] [PATCH v8 01/10] Add cache handling functions Orit Wasserman
2012-04-05 10:47 ` [Qemu-devel] [PATCH v8 02/10] Add uleb encoding/decoding functions Orit Wasserman
2012-04-05 10:47 ` [Qemu-devel] [PATCH v8 03/10] Add save_block_hdr function Orit Wasserman
2012-04-05 10:47 ` [Qemu-devel] [PATCH v8 04/10] Add host_from_stream_offset_versioned function Orit Wasserman
2012-04-05 10:47 ` [Qemu-devel] [PATCH v8 05/10] Add MigrationParams structure Orit Wasserman
2012-04-05 10:47 ` [Qemu-devel] [PATCH v8 06/10] Add XBZRLE to ram_save_block and ram_save_live Orit Wasserman
2012-04-05 10:47 ` Orit Wasserman [this message]
2012-04-05 10:47 ` [Qemu-devel] [PATCH v8 08/10] Add migration capabilites Orit Wasserman
2012-04-05 10:47 ` [Qemu-devel] [PATCH v8 09/10] Add set_cachesize command Orit Wasserman
2012-04-05 12:15   ` Avi Kivity
2012-04-05 12:17     ` Avi Kivity
2012-04-05 10:47 ` [Qemu-devel] [PATCH v8 10/10] Add XBZRLE statstics information Orit Wasserman

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=1333622879-12055-8-git-send-email-owasserm@redhat.com \
    --to=owasserm@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanha@gmail.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).