qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v8 07/10] Add XBZRLE option to migrate command


From: Orit Wasserman
Subject: [Qemu-devel] [PATCH v8 07/10] Add XBZRLE option to migrate command
Date: Thu, 5 Apr 2012 13:47:56 +0300

Signed-off-by: Orit Wasserman <address@hidden>
---
 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
address@hidden migrate [-d] [-b] [-i] @var{uri}
address@hidden 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]