mirror of https://gitee.com/openkylin/libvirt.git
virsh: add compression options for migration
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
This commit is contained in:
parent
061e24285f
commit
0d81f2318b
|
@ -9783,6 +9783,26 @@ static const vshCmdOptDef opts_migrate[] = {
|
|||
.type = VSH_OT_BOOL,
|
||||
.help = N_("compress repeated pages during live migration")
|
||||
},
|
||||
{.name = "comp-methods",
|
||||
.type = VSH_OT_STRING,
|
||||
.help = N_("comma separated list of compression methods to be used")
|
||||
},
|
||||
{.name = "comp-mt-level",
|
||||
.type = VSH_OT_INT,
|
||||
.help = N_("compress level for multithread compression")
|
||||
},
|
||||
{.name = "comp-mt-threads",
|
||||
.type = VSH_OT_INT,
|
||||
.help = N_("number of compession threads for multithread compression")
|
||||
},
|
||||
{.name = "comp-mt-dthreads",
|
||||
.type = VSH_OT_INT,
|
||||
.help = N_("number of decompession threads for multithread compression")
|
||||
},
|
||||
{.name = "comp-xbzrle-cache",
|
||||
.type = VSH_OT_INT,
|
||||
.help = N_("page cache size for xbzrle compression")
|
||||
},
|
||||
{.name = "auto-converge",
|
||||
.type = VSH_OT_BOOL,
|
||||
.help = N_("force convergence during live migration")
|
||||
|
@ -9863,6 +9883,9 @@ doMigrate(void *opaque)
|
|||
virTypedParameterPtr params = NULL;
|
||||
int nparams = 0;
|
||||
int maxparams = 0;
|
||||
int intOpt = 0;
|
||||
unsigned long long ullOpt = 0;
|
||||
int rv;
|
||||
virConnectPtr dconn = data->dconn;
|
||||
|
||||
sigemptyset(&sigmask);
|
||||
|
@ -9930,6 +9953,59 @@ doMigrate(void *opaque)
|
|||
VIR_FREE(val);
|
||||
}
|
||||
|
||||
if (vshCommandOptStringReq(ctl, cmd, "comp-methods", &opt) < 0)
|
||||
goto out;
|
||||
if (opt) {
|
||||
char **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, "comp-mt-level", &intOpt)) < 0) {
|
||||
goto out;
|
||||
} else if (rv > 0) {
|
||||
if (virTypedParamsAddInt(¶ms, &nparams, &maxparams,
|
||||
VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL,
|
||||
intOpt) < 0)
|
||||
goto save_error;
|
||||
}
|
||||
|
||||
if ((rv = vshCommandOptInt(ctl, cmd, "comp-mt-threads", &intOpt)) < 0) {
|
||||
goto out;
|
||||
} else if (rv > 0) {
|
||||
if (virTypedParamsAddInt(¶ms, &nparams, &maxparams,
|
||||
VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS,
|
||||
intOpt) < 0)
|
||||
goto save_error;
|
||||
}
|
||||
|
||||
if ((rv = vshCommandOptInt(ctl, cmd, "comp-mt-dthreads", &intOpt)) < 0) {
|
||||
goto out;
|
||||
} else if (rv > 0) {
|
||||
if (virTypedParamsAddInt(¶ms, &nparams, &maxparams,
|
||||
VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS,
|
||||
intOpt) < 0)
|
||||
goto save_error;
|
||||
}
|
||||
|
||||
if ((rv = vshCommandOptULongLong(ctl, cmd, "comp-xbzrle-cache", &ullOpt)) < 0) {
|
||||
goto out;
|
||||
} 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) {
|
||||
|
|
|
@ -1537,11 +1537,14 @@ to the I<uri> namespace is displayed instead of being modified.
|
|||
=item B<migrate> [I<--live>] [I<--offline>] [I<--direct>] [I<--p2p> [I<--tunnelled>]]
|
||||
[I<--persistent>] [I<--undefinesource>] [I<--suspend>] [I<--copy-storage-all>]
|
||||
[I<--copy-storage-inc>] [I<--change-protection>] [I<--unsafe>] [I<--verbose>]
|
||||
[I<--compressed>] [I<--abort-on-error>] [I<--auto-converge>] [I<--postcopy>]
|
||||
[I<--abort-on-error>] [I<--auto-converge>] [I<--postcopy>]
|
||||
[I<--postcopy-after-precopy>] I<domain> I<desturi> [I<migrateuri>]
|
||||
[I<graphicsuri>] [I<listen-address>] [I<dname>]
|
||||
[I<--timeout> B<seconds> [I<--timeout-suspend> | I<--timeout-postcopy>]]
|
||||
[I<--xml> B<file>] [I<--migrate-disks> B<disk-list>] [I<--disks-port> B<port>]
|
||||
[I<--compressed>] [I<--comp-methods> B<method-list>]
|
||||
[I<--comp-mt-level>] [I<--comp-mt-threads>] [I<--comp-mt-dthreads>]
|
||||
[I<--comp-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>
|
||||
|
@ -1564,8 +1567,7 @@ 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
|
||||
of 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<--postcopy> enables post-copy logic in migration, but does not
|
||||
|
@ -1602,6 +1604,16 @@ I<--timeout-postcopy> is used, virsh will switch migration from pre-copy
|
|||
to post-copy upon timeout; migration has to be started with I<--postcopy>
|
||||
option for this to work.
|
||||
|
||||
I<--compressed> activates compression, the compression method is chosen
|
||||
with I<--comp-methods>. Supported methods are "mt" and "xbzrle" and
|
||||
can be used in any combination. When no methods are specified, a hypervisor
|
||||
default methods will be used. QEMU defaults to "xbzrle". Compression methods
|
||||
can be tuned further. I<--comp-mt-level> sets compression level.
|
||||
Values are in range from 0 to 9, where 1 is maximum speed and 9 is maximum
|
||||
compression. I<--comp-mt-threads> and I<--comp-mt-dthreads> set the number
|
||||
of compress threads on source and the number of decompress threads on target
|
||||
respectively. I<--comp-xbzrle-cache> sets size of page cache in bytes.
|
||||
|
||||
Running migration can be canceled by interrupting virsh (usually using
|
||||
C<Ctrl-C>) or by B<domjobabort> command sent from another virsh instance.
|
||||
|
||||
|
|
Loading…
Reference in New Issue