Add multifd migration options: --parallel-compression --parallel-zlib-level --parallel-zstd-level
Signed-off-by: Jiang Jiacheng <jiangjiach...@huawei.com> --- docs/manpages/virsh.rst | 11 +++++++++-- tools/virsh-domain.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 88b7fa1da8..0024c80317 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -3359,7 +3359,8 @@ migrate [--comp-xbzrle-cache] [--auto-converge] [auto-converge-initial] [auto-converge-increment] [--persistent-xml file] [--tls] [--postcopy-bandwidth bandwidth] - [--parallel [--parallel-connections connections]] + [--parallel [--parallel-connections connections] + [--parallel-compression] [--parallel-zlib-level][--parallel-zstd-level]] [--bandwidth bandwidth] [--tls-destination hostname] [--disks-uri URI] [--copy-storage-synchronous-writes] @@ -3486,7 +3487,13 @@ starting the migration. parallel connections. The number of such connections can be set using *--parallel-connections*. Parallel connections may help with saturating the network link between the source and the target and thus speeding up the -migration. +migration. *--parallel-compression* sets the method of compression use +in multifd migration, supported choice are "none", "zlib" and "zstd" and +is set to "none" by default. *--parallel-zlib-level* sets the compression +level when using "zlib" as multifd migration's compression mesthod. Values +are in range from 0 to 9 and defaults to 1. *--parallel-zstd-level* sets +the compression level when using "zstd" as multifd migration's compression +mesthod. Values are in range from 0 to 20 and defaults to 1. Running migration can be canceled by interrupting virsh (usually using ``Ctrl-C``) or by ``domjobabort`` command sent from another virsh instance. diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 6b431bd1e5..2f2b3eba0c 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -11095,6 +11095,18 @@ static const vshCmdOptDef opts_migrate[] = { .type = VSH_OT_INT, .help = N_("number of connections for parallel migration") }, + {.name = "parallel-compression", + .type = VSH_OT_STRING, + .help = N_("compress method for parallel migration") + }, + {.name = "parallel-zlib-level", + .type = VSH_OT_INT, + .help = N_("zlib compression level used in parallel migration") + }, + {.name = "parallel-zstd-level", + .type = VSH_OT_INT, + .help = N_("zstd compression level used in parallel migration") + }, {.name = "bandwidth", .type = VSH_OT_INT, .help = N_("migration bandwidth limit in MiB/s") @@ -11326,6 +11338,33 @@ doMigrate(void *opaque) goto save_error; } + if (vshCommandOptStringReq(ctl, cmd, "parallel-compression", &opt) < 0) + goto out; + if (opt) { + if (virTypedParamsAddString(¶ms, &nparams, &maxparams, + VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION, + opt) < 0) + goto save_error; + } + + if ((rv = vshCommandOptInt(ctl, cmd, "parallel-zlib-level", &intOpt)) < 0) { + goto out; + } else if (rv > 0) { + if (virTypedParamsAddInt(¶ms, &nparams, &maxparams, + VIR_MIGRATE_PARAM_PARALLEL_ZLIB_LEVEL, + intOpt) < 0) + goto save_error; + } + + if ((rv = vshCommandOptInt(ctl, cmd, "parallel-zstd-level", &intOpt)) < 0) { + goto out; + } else if (rv > 0) { + if (virTypedParamsAddInt(¶ms, &nparams, &maxparams, + VIR_MIGRATE_PARAM_PARALLEL_ZSTD_LEVEL, + intOpt) < 0) + goto save_error; + } + if ((rv = vshCommandOptULongLong(ctl, cmd, "bandwidth", &ullOpt)) < 0) { goto out; } else if (rv > 0) { -- 2.33.0