virsh: Add migrate options to set parallel compress level

Add migrate options: --compression-zlib-level
                     --compression-zstd-level
These options are used to set compress level for "zlib"
or "zstd" during parallel migration if the compress method
is specified.

Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiang Jiacheng 2023-02-24 17:27:11 +08:00 committed by Jiri Denemark
parent 150ae3e62b
commit 4ab5591c95
2 changed files with 47 additions and 9 deletions

View File

@ -3372,7 +3372,8 @@ migrate
[--xml file] [--migrate-disks disk-list] [--disks-port port]
[--compressed] [--comp-methods method-list]
[--comp-mt-level] [--comp-mt-threads] [--comp-mt-dthreads]
[--comp-xbzrle-cache] [--auto-converge] [auto-converge-initial]
[--comp-xbzrle-cache] [--comp-zlib-level] [--comp-zstd-level]
[--auto-converge] [auto-converge-initial]
[auto-converge-increment] [--persistent-xml file] [--tls]
[--postcopy-bandwidth bandwidth]
[--parallel [--parallel-connections connections]]
@ -3479,14 +3480,25 @@ to post-copy upon timeout; migration has to be started with *--postcopy*
option for this to work.
*--compressed* activates compression, the compression method is chosen
with *--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. *--comp-mt-level* sets compression level.
Values are in range from 0 to 9, where 1 is maximum speed and 9 is maximum
compression. *--comp-mt-threads* and *--comp-mt-dthreads* set the number
of compress threads on source and the number of decompress threads on target
respectively. *--comp-xbzrle-cache* sets size of page cache in bytes.
with *--comp-methods*. Supported methods are "mt", "xbzrle", "zlib",
and "zstd". The supported set of methods and their combinations depend
on a hypervisor and migration options. QEMU only supports "zlib" and
"zstd" methods when *--parallel* is used and they cannot be used at
once. When no methods are specified, a hypervisor default methods will
be used. QEMU defaults to "xbzrle" as long as *--parallel* is not used.
For *--parallel* migrations QEMU does not provide any default compression
method and thus it has to be specified explicitly using *--comp-method*.
Compression methods can be tuned further. *--comp-mt-level* sets
compression level for "mt" method. Values are in range from 0 to 9, where 1
is maximum speed and 9 is maximum compression. *--comp-mt-threads* and
*--comp-mt-dthreads* set the number of compress threads on source and the
number of decompress threads on target respectively. *--comp-xbzrle-cache*
sets size of page cache in bytes. *--comp-zlib-level* sets the compression
level when using "zlib" method. Values are in range from 0 to 9 and defaults
to 1, where 0 is no compression, 1 is maximum speed and 9 is maximum
compression. *--comp-zstd-level* sets the compression level when using "zstd"
method. Values are in range from 0 to 20 and defaults to 1, where 0 is no
compression, 1 is maximum speed and 20 is maximum compression.
Providing *--tls* causes the migration to use the host configured TLS setup
(see migrate_tls_x509_cert_dir in /etc/libvirt/qemu.conf) in order to perform

View File

@ -11076,6 +11076,14 @@ static const vshCmdOptDef opts_migrate[] = {
.completer = virshCompleteEmpty,
.help = N_("override the destination host name used for TLS verification")
},
{.name = "comp-zlib-level",
.type = VSH_OT_INT,
.help = N_("compress level for zlib compression")
},
{.name = "comp-zstd-level",
.type = VSH_OT_INT,
.help = N_("compress level for zstd compression")
},
{.name = NULL}
};
@ -11288,6 +11296,24 @@ doMigrate(void *opaque)
goto save_error;
}
if ((rv = vshCommandOptInt(ctl, cmd, "comp-zlib-level", &intOpt)) < 0) {
goto out;
} else if (rv > 0) {
if (virTypedParamsAddInt(&params, &nparams, &maxparams,
VIR_MIGRATE_PARAM_COMPRESSION_ZLIB_LEVEL,
intOpt) < 0)
goto save_error;
}
if ((rv = vshCommandOptInt(ctl, cmd, "comp-zstd-level", &intOpt)) < 0) {
goto out;
} else if (rv > 0) {
if (virTypedParamsAddInt(&params, &nparams, &maxparams,
VIR_MIGRATE_PARAM_COMPRESSION_ZSTD_LEVEL,
intOpt) < 0)
goto save_error;
}
if ((rv = vshCommandOptULongLong(ctl, cmd, "bandwidth", &ullOpt)) < 0) {
goto out;
} else if (rv > 0) {