From: ShaoHe Feng <shaohe.feng(a)intel.com>
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
tools/virsh-domain.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/virsh.pod | 25 ++++++++++++----
2 files changed, 104 insertions(+), 5 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index c2146d2..af81372 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -9644,6 +9644,31 @@ static const vshCmdOptDef opts_migrate[] = {
.type = VSH_OT_STRING,
.help = N_("comma separated list of disks to be migrated")
},
+ {.name = "compression-method",
+ .type = VSH_OT_STRING,
+ .help = N_("comma separated list of compression method to be used")
+ },
+ {.name = "compression-mt-level",
+ .type = VSH_OT_INT,
+ .help = N_("compress level for multithread compression. "
+ "Values are in range 0-9, 9 means maximum compression. "
+ "'multithread' compression method must be selected with this
option.")
+ },
+ {.name = "compression-mt-threads",
+ .type = VSH_OT_INT,
+ .help = N_("number of compession threads from multithread compression. "
+ "'multithread' compression method must be selected with this
option.")
+ },
+ {.name = "compression-mt-dthreads",
+ .type = VSH_OT_INT,
+ .help = N_("number of decompession threads from multithread compression.
"
+ "'multithread' compression method must be selected with this
option.")
+ },
+ {.name = "compression-xbzrle-cache",
+ .type = VSH_OT_INT,
+ .help = N_("page cache size for xbzrle compression. "
+ "'xbzrle' compression method must be selected with this
option.")
+ },
{.name = NULL}
};
@@ -9662,6 +9687,10 @@ doMigrate(void *opaque)
virTypedParameterPtr params = NULL;
int nparams = 0;
int maxparams = 0;
+ int intOpt = 0;
+ unsigned int uintOpt = 0;
+ unsigned long long ullOpt = 0;
+ int rv;
virConnectPtr dconn = data->dconn;
sigemptyset(&sigmask);
@@ -9722,6 +9751,61 @@ doMigrate(void *opaque)
VIR_FREE(val);
}
+ if (vshCommandOptStringReq(ctl, cmd, "compression-method", &opt) <
0)
+ goto out;
+ if (opt) {
+ char **val = NULL;
+
+ val = virStringSplit(opt, ",", 0);
+
+ if (virTypedParamsAddStringList(¶ms,
+ &nparams,
+ &maxparams,
+ VIR_MIGRATE_PARAM_COMPRESSION,
+ (const char **)val) < 0) {
+ VIR_FREE(val);
+ goto save_error;
+ }
+
+ VIR_FREE(val);
+ }
+
+ if ((rv = vshCommandOptInt(ctl, cmd, "compression-mt-level", &intOpt))
< 0) {
+ goto save_error;
+ } else if (rv > 0) {
+ if (virTypedParamsAddInt(¶ms, &nparams, &maxparams,
+ VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL,
+ intOpt) < 0)
+ goto save_error;
+ }
+
+ if ((rv = vshCommandOptUInt(ctl, cmd, "compression-mt-threads",
&uintOpt)) < 0) {
+ goto save_error;
+ } else if (rv > 0) {
+ if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams,
+ VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS,
+ uintOpt) < 0)
+ goto save_error;
+ }
+
+ if ((rv = vshCommandOptUInt(ctl, cmd, "compression-mt-dthreads",
&uintOpt)) < 0) {
+ goto save_error;
+ } else if (rv > 0) {
+ if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams,
+ VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS,
+ uintOpt) < 0)
+ goto save_error;
+ }
+
+ if ((rv = vshCommandOptULongLong(ctl, cmd, "compression-xbzrle-cache",
&ullOpt)) < 0) {
+ goto save_error;
+ } else if (rv > 0) {
+ if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams,
+ VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE,
+ ullOpt) < 0)
+ goto save_error;
+ }
+
if (vshCommandOptStringReq(ctl, cmd, "xml", &opt) < 0)
goto out;
if (opt) {
diff --git a/tools/virsh.pod b/tools/virsh.pod
index e830c59..9fb01ac 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -1532,7 +1532,9 @@ to the I<uri> namespace is displayed instead of being
modified.
[I<--compressed>] [I<--abort-on-error>] [I<--auto-converge>]
I<domain> I<desturi> [I<migrateuri>] [I<graphicsuri>]
[I<listen-address>]
[I<dname>] [I<--timeout> B<seconds>] [I<--xml> B<file>]
-[I<--migrate-disks> B<disk-list>]
+[I<--migrate-disks> B<disk-list>] [I<--compression-method>
B<method-list>]
+[I<--compression-mt-level>] [I<--compression-mt-threads>]
[I<--compression-mt-dthreads>]
+[I<--compression-xbzrle-cache>]
Migrate domain to another host. Add I<--live> for live migration; <--p2p>
for peer-2-peer migration; I<--direct> for direct migration; or
I<--tunnelled>
@@ -1555,10 +1557,14 @@ enforces that no incompatible configuration changes will be made
to the domain
while the migration is underway; this flag is implicitly enabled when supported
by the hypervisor, but can be explicitly used to reject the migration if the
hypervisor lacks change protection support. I<--verbose> displays the progress
-of migration. I<--compressed> activates compression of memory pages that have
-to be transferred repeatedly during live migration. I<--abort-on-error> cancels
-the migration if a soft error (for example I/O error) happens during the
-migration. I<--auto-converge> forces convergence during live migration.
+of migration. I<--compressed> activates default compression method
+during migration. I<--abort-on-error> cancels the migration if a soft error
+(for example I/O error) happens during the migration. I<--auto-converge>
+forces convergence during live migration. I<--compression-methods>
+configures compression methods to use during migration in the comma separated
+B<method-list> argument. Compression methods are driver specific.
+Compression methods can be tuned further using various [--<compression-*>]
+options.
B<Note>: Individual hypervisors usually do not support all possible types of
migration. For example, QEMU does not support direct migration.
@@ -1594,6 +1600,15 @@ managed migration.
B<Note>: The I<desturi> parameter for normal migration and peer2peer
migration
has different semantics:
+QEMU supports "multithread" and "xbzrle" methods which can be used in
any
+combination. I<--compression-mt-level> sets compression level for multithread
+method. Values are in range from 0 to 9, where 1 is maximum speed and 9 is maximum
+compression. I<--compression-mt-threads> and I<--compression-mt-dthreads>
set
+the number of compress threads on source and the number of decompress threads
+on target respectively. I<--compression-xbzrle-cache> sets size of page cache in
+bytes for xbzrle method. I<--compressed> turns on "xbzrle" compression
method with
+current compression parameters.
+
=over 4
=item * normal migration: the I<desturi> is an address of the target host as
--
1.8.3.1