[PATCH 0/3] migration: add qemu multifd migration options

Add qemu multifd migration options to set multifd-compression multifd-zlib-level and multifd-zstd-level. Jiang Jiacheng (3): Add public API for parallel compression method qemu: Add qemu parallel migration parameters virsh: Add options for multifd migration compression docs/manpages/virsh.rst | 11 +++++++-- include/libvirt/libvirt-domain.h | 30 ++++++++++++++++++++++++ src/qemu/qemu_migration.h | 3 +++ src/qemu/qemu_migration_params.c | 29 +++++++++++++++++++++++- src/qemu/qemu_migration_params.h | 3 +++ tools/virsh-domain.c | 39 ++++++++++++++++++++++++++++++++ 6 files changed, 112 insertions(+), 3 deletions(-) -- 2.33.0

Add public API VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION, VIR_MIGRATE_PARAM_PARALLEL_ZLIB_LEVEL, VIR_MIGRATE_PARAM_PARALLEL_ZSTD_LEVEL for migration APIs to support set compression method and compress level used during migration. Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com> --- include/libvirt/libvirt-domain.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index 5152ed4551..981f4e5160 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1351,6 +1351,36 @@ typedef enum { */ # define VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS "parallel.connections" +/** + * VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION: + * + * virDomainMigrate* params field: compression method used during parallel + * migration. As VIR_TYPED_PARAM_INT. + * + * Since: 9.1.0 + */ +# define VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION "parallel.compression" + +/** + * VIR_MIGRATE_PARAM_PARALLEL_ZLIB_LEVEL: + * + * virDomainMigrate* params field: zlib compress level used during parallel + * migration. As VIR_TYPED_PARAM_INT. + * + * Since: 9.1.0 + */ +# define VIR_MIGRATE_PARAM_PARALLEL_ZLIB_LEVEL "parallel.zlib.level" + +/** + * VIR_MIGRATE_PARAM_PARALLEL_ZSTD_LEVEL: + * + * virDomainMigrate* params field: zstd compress level used during parallel + * migration. As VIR_TYPED_PARAM_INT. + * + * Since: 9.1.0 + */ +# define VIR_MIGRATE_PARAM_PARALLEL_ZSTD_LEVEL "parallel.zstd.level" + /** * VIR_MIGRATE_PARAM_TLS_DESTINATION: * -- 2.33.0

Hi, On 1/16/23 14:42, Jiang Jiacheng wrote:
Add public API VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION, VIR_MIGRATE_PARAM_PARALLEL_ZLIB_LEVEL, VIR_MIGRATE_PARAM_PARALLEL_ZSTD_LEVEL for migration APIs to support set compression method and compress level used during migration.
Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com>
we don't know what drivers other than QEMU are going to implement in terms of algorithms, and we also don't know what new algorithms QEMU will come up with in the future, so I was told when I was working on something similar (but not identical), for the "multifd save restore prototype" to try to make it more general. First of all, maybe we don't need two different _LEVEL parameters, just a VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION_LEVEL, which is then mapped in the qemu driver to the specific correct QEMU parameter according to the chosen algo. Then the VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION could be a freeform string, that is then interpreted by each driver, for example "zlib", or "zstd" in this case. So other drivers can pass different strings, and QEMU future new compression algorithms will not need changes to libvirt at all. Thanks, Claudio
--- include/libvirt/libvirt-domain.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index 5152ed4551..981f4e5160 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1351,6 +1351,36 @@ typedef enum { */ # define VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS "parallel.connections"
+/** + * VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION: + * + * virDomainMigrate* params field: compression method used during parallel + * migration. As VIR_TYPED_PARAM_INT. + * + * Since: 9.1.0 + */ +# define VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION "parallel.compression" + +/** + * VIR_MIGRATE_PARAM_PARALLEL_ZLIB_LEVEL: + * + * virDomainMigrate* params field: zlib compress level used during parallel + * migration. As VIR_TYPED_PARAM_INT. + * + * Since: 9.1.0 + */ +# define VIR_MIGRATE_PARAM_PARALLEL_ZLIB_LEVEL "parallel.zlib.level" + +/** + * VIR_MIGRATE_PARAM_PARALLEL_ZSTD_LEVEL: + * + * virDomainMigrate* params field: zstd compress level used during parallel + * migration. As VIR_TYPED_PARAM_INT. + * + * Since: 9.1.0 + */ +# define VIR_MIGRATE_PARAM_PARALLEL_ZSTD_LEVEL "parallel.zstd.level" + /** * VIR_MIGRATE_PARAM_TLS_DESTINATION: *

On 2023/1/17 16:44, Claudio Fontana wrote:
Hi,
On 1/16/23 14:42, Jiang Jiacheng wrote:
Add public API VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION, VIR_MIGRATE_PARAM_PARALLEL_ZLIB_LEVEL, VIR_MIGRATE_PARAM_PARALLEL_ZSTD_LEVEL for migration APIs to support set compression method and compress level used during migration.
Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com>
we don't know what drivers other than QEMU are going to implement in terms of algorithms, and we also don't know what new algorithms QEMU will come up with in the future,
Indeed, what you're talking about is better and more scalable. These patches only adapt to the three parameters of the current version QEMU,and some commits on the QEMU side may be required to support this mode.
so I was told when I was working on something similar (but not identical), for the "multifd save restore prototype" to try to make it more general.
First of all, maybe we don't need two different _LEVEL parameters, just a VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION_LEVEL, which is then mapped in the qemu driver to the specific correct QEMU parameter according to the chosen algo.
Since QEMU sets different parameters for different compression methods, I've added two corresponding parameters here. If the qemu side does not change, we can use the same virsh option to input the compression level and pass the expected QEMU parameters according to the input compression method on the libvirt side.
Then the VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION could be a freeform string, that is then interpreted by each driver, for example "zlib", or "zstd" in this case. So other drivers can pass different strings, and QEMU future new compression algorithms will not need changes to libvirt at all.
I think what you mean is we can input any string to VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION and whether it is available is judged by QEMU or other emulators. It is supported with these patches, we can use any string for this parameter, though QEMU only support 'none', 'zlib','zstd' for it, and other input will return with an error. Thanks for your reply and suggestion! Jiang Jiacheng
Thanks,
Claudio
--- include/libvirt/libvirt-domain.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index 5152ed4551..981f4e5160 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1351,6 +1351,36 @@ typedef enum { */ # define VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS "parallel.connections"
+/** + * VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION: + * + * virDomainMigrate* params field: compression method used during parallel + * migration. As VIR_TYPED_PARAM_INT. + * + * Since: 9.1.0 + */ +# define VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION "parallel.compression" + +/** + * VIR_MIGRATE_PARAM_PARALLEL_ZLIB_LEVEL: + * + * virDomainMigrate* params field: zlib compress level used during parallel + * migration. As VIR_TYPED_PARAM_INT. + * + * Since: 9.1.0 + */ +# define VIR_MIGRATE_PARAM_PARALLEL_ZLIB_LEVEL "parallel.zlib.level" + +/** + * VIR_MIGRATE_PARAM_PARALLEL_ZSTD_LEVEL: + * + * virDomainMigrate* params field: zstd compress level used during parallel + * migration. As VIR_TYPED_PARAM_INT. + * + * Since: 9.1.0 + */ +# define VIR_MIGRATE_PARAM_PARALLEL_ZSTD_LEVEL "parallel.zstd.level" + /** * VIR_MIGRATE_PARAM_TLS_DESTINATION: *

On Tue, Jan 17, 2023 at 21:58:39 +0800, Jiang Jiacheng wrote:
On 2023/1/17 16:44, Claudio Fontana wrote:
Hi,
On 1/16/23 14:42, Jiang Jiacheng wrote:
Add public API VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION, VIR_MIGRATE_PARAM_PARALLEL_ZLIB_LEVEL, VIR_MIGRATE_PARAM_PARALLEL_ZSTD_LEVEL for migration APIs to support set compression method and compress level used during migration.
Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com>
we don't know what drivers other than QEMU are going to implement in terms of algorithms, and we also don't know what new algorithms QEMU will come up with in the future,
Indeed, what you're talking about is better and more scalable. These patches only adapt to the three parameters of the current version QEMU,and some commits on the QEMU side may be required to support this mode.
so I was told when I was working on something similar (but not identical), for the "multifd save restore prototype" to try to make it more general.
First of all, maybe we don't need two different _LEVEL parameters, just a VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION_LEVEL, which is then mapped in the qemu driver to the specific correct QEMU parameter according to the chosen algo.
Since QEMU sets different parameters for different compression methods, I've added two corresponding parameters here. If the qemu side does not change, we can use the same virsh option to input the compression level and pass the expected QEMU parameters according to the input compression method on the libvirt side.
Then the VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION could be a freeform string, that is then interpreted by each driver, for example "zlib", or "zstd" in this case. So other drivers can pass different strings, and QEMU future new compression algorithms will not need changes to libvirt at all.
I think what you mean is we can input any string to VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION and whether it is available is judged by QEMU or other emulators. It is supported with these patches, we can use any string for this parameter, though QEMU only support 'none', 'zlib','zstd' for it, and other input will return with an error.
I think we should just be able to use the existing VIR_MIGRATE_PARAM_COMPRESSION to specify the method. We know whether we're asking for parallel migration from VIR_MIGRATE_PARALLEL flag. We might need to add checks for which compression methods are only allowed with/without VIR_MIGRATE_PARALLEL. On the other hand, for consistency reasons I think we should add separate VIR_MIGRATE_PARAM_COMPRESSION_ZLIB_LEVEL and VIR_MIGRATE_PARAM_COMPRESSION_ZSTD_LEVEL even though they are the same. The other two compressions methods we currently support (mt and xbzrle) have each their own set of parameters. Jirka

On 2023/1/18 0:13, Jiri Denemark wrote:
On Tue, Jan 17, 2023 at 21:58:39 +0800, Jiang Jiacheng wrote:
On 2023/1/17 16:44, Claudio Fontana wrote:
Hi,
On 1/16/23 14:42, Jiang Jiacheng wrote:
Add public API VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION, VIR_MIGRATE_PARAM_PARALLEL_ZLIB_LEVEL, VIR_MIGRATE_PARAM_PARALLEL_ZSTD_LEVEL for migration APIs to support set compression method and compress level used during migration.
Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com>
we don't know what drivers other than QEMU are going to implement in terms of algorithms, and we also don't know what new algorithms QEMU will come up with in the future,
Indeed, what you're talking about is better and more scalable. These patches only adapt to the three parameters of the current version QEMU,and some commits on the QEMU side may be required to support this mode.
I should fix that we don't need commits in QEMU to implement in this way.
so I was told when I was working on something similar (but not identical), for the "multifd save restore prototype" to try to make it more general.
First of all, maybe we don't need two different _LEVEL parameters, just a VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION_LEVEL, which is then mapped in the qemu driver to the specific correct QEMU parameter according to the chosen algo.
Since QEMU sets different parameters for different compression methods, I've added two corresponding parameters here. If the qemu side does not change, we can use the same virsh option to input the compression level and pass the expected QEMU parameters according to the input compression method on the libvirt side.
same here.
Then the VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION could be a freeform string, that is then interpreted by each driver, for example "zlib", or "zstd" in this case. So other drivers can pass different strings, and QEMU future new compression algorithms will not need changes to libvirt at all.
I think what you mean is we can input any string to VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION and whether it is available is judged by QEMU or other emulators. It is supported with these patches, we can use any string for this parameter, though QEMU only support 'none', 'zlib','zstd' for it, and other input will return with an error.
I think we should just be able to use the existing VIR_MIGRATE_PARAM_COMPRESSION to specify the method. We know whether we're asking for parallel migration from VIR_MIGRATE_PARALLEL flag. We might need to add checks for which compression methods are only allowed with/without VIR_MIGRATE_PARALLEL.
I see, I will try this way and add necessary check for them in next version.
On the other hand, for consistency reasons I think we should add separate VIR_MIGRATE_PARAM_COMPRESSION_ZLIB_LEVEL and VIR_MIGRATE_PARAM_COMPRESSION_ZSTD_LEVEL even though they are the same. The other two compressions methods we currently support (mt and xbzrle) have each their own set of parameters.
If so, shall we keeping using separate virsh migrate options(like --comp-zlib-level and --comp-zstd-level)? Or just use one option (--parallel-comp-level) to pass compression level, according to the compression method we have chosen? Thanks Jiang Jiacheng
Jirka

On Wed, Jan 18, 2023 at 21:52:30 +0800, Jiang Jiacheng wrote:
I think we should just be able to use the existing VIR_MIGRATE_PARAM_COMPRESSION to specify the method. We know whether we're asking for parallel migration from VIR_MIGRATE_PARALLEL flag. We might need to add checks for which compression methods are only allowed with/without VIR_MIGRATE_PARALLEL.
I see, I will try this way and add necessary check for them in next version.
On the other hand, for consistency reasons I think we should add separate VIR_MIGRATE_PARAM_COMPRESSION_ZLIB_LEVEL and VIR_MIGRATE_PARAM_COMPRESSION_ZSTD_LEVEL even though they are the same. The other two compressions methods we currently support (mt and xbzrle) have each their own set of parameters.
If so, shall we keeping using separate virsh migrate options(like --comp-zlib-level and --comp-zstd-level)? Or just use one option (--parallel-comp-level) to pass compression level, according to the compression method we have chosen?
Separate options, please, (i.e., --comp-zlib-level and --comp-zstd-level) to be consistent with the API. Jirka

Add qemu migration parameters to support setting multifd migration compression method and level. Those parameters has been supportted by QEMU since 5.0. Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com> --- src/qemu/qemu_migration.h | 3 +++ src/qemu/qemu_migration_params.c | 29 ++++++++++++++++++++++++++++- src/qemu/qemu_migration_params.h | 3 +++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h index d21b6f67e8..c099eb8356 100644 --- a/src/qemu/qemu_migration.h +++ b/src/qemu/qemu_migration.h @@ -86,6 +86,9 @@ VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT, VIR_TYPED_PARAM_INT, \ VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY, VIR_TYPED_PARAM_ULLONG, \ VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS, VIR_TYPED_PARAM_INT, \ + VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION, VIR_TYPED_PARAM_STRING, \ + VIR_MIGRATE_PARAM_PARALLEL_ZLIB_LEVEL, VIR_TYPED_PARAM_INT, \ + VIR_MIGRATE_PARAM_PARALLEL_ZSTD_LEVEL, VIR_TYPED_PARAM_INT, \ VIR_MIGRATE_PARAM_TLS_DESTINATION, VIR_TYPED_PARAM_STRING, \ VIR_MIGRATE_PARAM_DISKS_URI, VIR_TYPED_PARAM_STRING, \ NULL diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c index bd09dcfb23..6b68214083 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -114,6 +114,9 @@ VIR_ENUM_IMPL(qemuMigrationParam, "xbzrle-cache-size", "max-postcopy-bandwidth", "multifd-channels", + "multifd-compression", + "multifd-zlib-level", + "multifd-zstd-level", ); typedef struct _qemuMigrationParamsAlwaysOnItem qemuMigrationParamsAlwaysOnItem; @@ -225,6 +228,18 @@ static const qemuMigrationParamsTPMapItem qemuMigrationParamsTPMap[] = { .param = QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS, .party = QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION}, + {.typedParam = VIR_MIGRATE_PARAM_PARALLEL_COMPRESSION, + .param = QEMU_MIGRATION_PARAM_MULTIFD_COMPRESSION, + .party = QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION}, + + {.typedParam = VIR_MIGRATE_PARAM_PARALLEL_ZLIB_LEVEL, + .param = QEMU_MIGRATION_PARAM_MULTIFD_ZLIB_LEVEL, + .party = QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION}, + + {.typedParam = VIR_MIGRATE_PARAM_PARALLEL_ZSTD_LEVEL, + .param = QEMU_MIGRATION_PARAM_MULTIFD_ZSTD_LEVEL, + .party = QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION}, + {.typedParam = VIR_MIGRATE_PARAM_TLS_DESTINATION, .param = QEMU_MIGRATION_PARAM_TLS_HOSTNAME, .party = QEMU_MIGRATION_SOURCE}, @@ -271,6 +286,15 @@ static const qemuMigrationParamInfoItem qemuMigrationParamInfo[] = { [QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS] = { .type = QEMU_MIGRATION_PARAM_TYPE_INT, }, + [QEMU_MIGRATION_PARAM_MULTIFD_COMPRESSION] = { + .type = QEMU_MIGRATION_PARAM_TYPE_STRING, + }, + [QEMU_MIGRATION_PARAM_MULTIFD_ZLIB_LEVEL] = { + .type = QEMU_MIGRATION_PARAM_TYPE_INT, + }, + [QEMU_MIGRATION_PARAM_MULTIFD_ZSTD_LEVEL] = { + .type = QEMU_MIGRATION_PARAM_TYPE_INT, + }, }; G_STATIC_ASSERT(G_N_ELEMENTS(qemuMigrationParamInfo) == QEMU_MIGRATION_PARAM_LAST); @@ -662,7 +686,10 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params, return NULL; } - if (migParams->params[QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS].set && + if ((migParams->params[QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS].set || + migParams->params[QEMU_MIGRATION_PARAM_MULTIFD_COMPRESSION].set || + migParams->params[QEMU_MIGRATION_PARAM_MULTIFD_ZLIB_LEVEL].set || + migParams->params[QEMU_MIGRATION_PARAM_MULTIFD_ZSTD_LEVEL].set) && !(flags & VIR_MIGRATE_PARALLEL)) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("Turn parallel migration on to tune it")); diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h index e7c65f6a21..5857673227 100644 --- a/src/qemu/qemu_migration_params.h +++ b/src/qemu/qemu_migration_params.h @@ -59,6 +59,9 @@ typedef enum { QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE, QEMU_MIGRATION_PARAM_MAX_POSTCOPY_BANDWIDTH, QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS, + QEMU_MIGRATION_PARAM_MULTIFD_COMPRESSION, + QEMU_MIGRATION_PARAM_MULTIFD_ZLIB_LEVEL, + QEMU_MIGRATION_PARAM_MULTIFD_ZSTD_LEVEL, QEMU_MIGRATION_PARAM_LAST } qemuMigrationParam; -- 2.33.0

Add multifd migration options: --parallel-compression --parallel-zlib-level --parallel-zstd-level Signed-off-by: Jiang Jiacheng <jiangjiacheng@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

Hi, On 1/16/23 14:42, Jiang Jiacheng wrote:
Add qemu multifd migration options to set multifd-compression multifd-zlib-level and multifd-zstd-level.
I think what you are adding here is a new parallel compression method and parallel compression level option, and a specific implementation for the QEMU driver? Thanks, Claudio
Jiang Jiacheng (3): Add public API for parallel compression method qemu: Add qemu parallel migration parameters virsh: Add options for multifd migration compression
docs/manpages/virsh.rst | 11 +++++++-- include/libvirt/libvirt-domain.h | 30 ++++++++++++++++++++++++ src/qemu/qemu_migration.h | 3 +++ src/qemu/qemu_migration_params.c | 29 +++++++++++++++++++++++- src/qemu/qemu_migration_params.h | 3 +++ tools/virsh-domain.c | 39 ++++++++++++++++++++++++++++++++ 6 files changed, 112 insertions(+), 3 deletions(-)

On 2023/1/17 16:32, Claudio Fontana wrote:
Hi,
On 1/16/23 14:42, Jiang Jiacheng wrote:
Add qemu multifd migration options to set multifd-compression multifd-zlib-level and multifd-zstd-level.
I think what you are adding here is a new parallel compression method and parallel compression level option, and a specific implementation for the QEMU driver?
Actually, those compression method and compression level option has been supported by QEMU since 5.0. I want to add interfaces for them in libvirt. Thanks Jiang Jiacheng
Thanks,
Claudio
Jiang Jiacheng (3): Add public API for parallel compression method qemu: Add qemu parallel migration parameters virsh: Add options for multifd migration compression
docs/manpages/virsh.rst | 11 +++++++-- include/libvirt/libvirt-domain.h | 30 ++++++++++++++++++++++++ src/qemu/qemu_migration.h | 3 +++ src/qemu/qemu_migration_params.c | 29 +++++++++++++++++++++++- src/qemu/qemu_migration_params.h | 3 +++ tools/virsh-domain.c | 39 ++++++++++++++++++++++++++++++++ 6 files changed, 112 insertions(+), 3 deletions(-)
participants (3)
-
Claudio Fontana
-
Jiang Jiacheng
-
Jiri Denemark