代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/libvirt 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From f098a118012a298516521b92c7c7ca844c868176 Mon Sep 17 00:00:00 2001
From: jipengfei <jipengfei_yewu@cmss.chinamobile.com>
Date: Thu, 9 Feb 2023 08:33:01 +0800
Subject: [PATCH] live_migrate: virsh migrate command supports the zstd
compression algorithm
When executing virsh migrate, specify a compression algorithm using
--comp-algorithm. You can choose zlib or zstd.
Signed-off-by: jipengfei <jipengfei_yewu@cmss.chinamobile.com>
---
include/libvirt/libvirt-domain.h | 10 ++++++++++
src/qemu/qemu_migration.h | 1 +
src/qemu/qemu_migration_params.c | 9 ++++++++-
src/qemu/qemu_migration_params.h | 1 +
tools/virsh-domain.c | 12 ++++++++++++
5 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 8fe723198d..36319c9130 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -1073,6 +1073,16 @@ typedef enum {
*/
# define VIR_MIGRATE_PARAM_TLS_DESTINATION "tls.destination"
+/**
+* VIR_MIGRATE_PARAM_COMPRESSION_ALGORITHM:
+*
+* virDomainMigrate* params field: choose compression algorithm, you can choose
+* zlib or zstd.
+*
+* Since: 6.2.0
+*/
+# define VIR_MIGRATE_PARAM_COMPRESSION_ALGORITHM "compression.algorithm"
+
/* Domain migration. */
virDomainPtr virDomainMigrate (virDomainPtr domain, virConnectPtr dconn,
unsigned long flags, const char *dname,
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index 316a1a10f4..28e4cd7fe7 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -85,6 +85,7 @@
VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS, VIR_TYPED_PARAM_INT, \
VIR_MIGRATE_PARAM_TLS_DESTINATION, VIR_TYPED_PARAM_STRING, \
VIR_MIGRATE_PARAM_MIGRATIONPIN, VIR_TYPED_PARAM_STRING, \
+ VIR_MIGRATE_PARAM_COMPRESSION_ALGORITHM, VIR_TYPED_PARAM_STRING, \
NULL
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 4001fb2b34..d1423ff4cf 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -109,6 +109,7 @@ VIR_ENUM_IMPL(qemuMigrationParam,
"max-postcopy-bandwidth",
"multifd-channels",
"migrationpin",
+ "compress-method",
);
typedef struct _qemuMigrationParamsAlwaysOnItem qemuMigrationParamsAlwaysOnItem;
@@ -206,6 +207,10 @@ static const qemuMigrationParamsTPMapItem qemuMigrationParamsTPMap[] = {
{.typedParam = VIR_MIGRATE_PARAM_MIGRATIONPIN,
.param = QEMU_MIGRATION_PARAM_MIGRATIONPIN,
.party = QEMU_MIGRATION_SOURCE},
+
+ {.typedParam = VIR_MIGRATE_PARAM_COMPRESSION_ALGORITHM,
+ .param = QEMU_MIGRATION_PARAM_COMPRESS_METHOD,
+ .party = QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION},
};
static const qemuMigrationParamType qemuMigrationParamTypes[] = {
@@ -223,6 +228,7 @@ static const qemuMigrationParamType qemuMigrationParamTypes[] = {
[QEMU_MIGRATION_PARAM_MAX_POSTCOPY_BANDWIDTH] = QEMU_MIGRATION_PARAM_TYPE_ULL,
[QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS] = QEMU_MIGRATION_PARAM_TYPE_INT,
[QEMU_MIGRATION_PARAM_MIGRATIONPIN] = QEMU_MIGRATION_PARAM_TYPE_STRING,
+ [QEMU_MIGRATION_PARAM_COMPRESS_METHOD] = QEMU_MIGRATION_PARAM_TYPE_STRING,
};
G_STATIC_ASSERT(G_N_ELEMENTS(qemuMigrationParamTypes) == QEMU_MIGRATION_PARAM_LAST);
@@ -516,7 +522,8 @@ qemuMigrationParamsSetCompression(virTypedParameterPtr params,
if ((migParams->params[QEMU_MIGRATION_PARAM_COMPRESS_LEVEL].set ||
migParams->params[QEMU_MIGRATION_PARAM_COMPRESS_THREADS].set ||
- migParams->params[QEMU_MIGRATION_PARAM_DECOMPRESS_THREADS].set) &&
+ migParams->params[QEMU_MIGRATION_PARAM_DECOMPRESS_THREADS].set ||
+ migParams->params[QEMU_MIGRATION_PARAM_COMPRESS_METHOD].set) &&
!(migParams->compMethods & (1ULL << QEMU_MIGRATION_COMPRESS_MT))) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("Turn multithread compression on to tune it"));
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
index f3deffb4cc..ae95723705 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -59,6 +59,7 @@ typedef enum {
QEMU_MIGRATION_PARAM_MAX_POSTCOPY_BANDWIDTH,
QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS,
QEMU_MIGRATION_PARAM_MIGRATIONPIN,
+ QEMU_MIGRATION_PARAM_COMPRESS_METHOD,
QEMU_MIGRATION_PARAM_LAST
} qemuMigrationParam;
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 0d58775289..595a210493 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -10723,6 +10723,11 @@ static const vshCmdOptDef opts_migrate[] = {
.type = VSH_OT_STRING,
.help = N_("override the destination host name used for TLS verification")
},
+ {.name = "comp-algorithm",
+ .type = VSH_OT_STRING,
+ .help = N_("choose migration compression algorithm")
+ },
+
{.name = NULL}
};
@@ -10866,6 +10871,13 @@ doMigrate(void *opaque)
goto save_error;
}
+ if (vshCommandOptStringReq(ctl, cmd, "comp-algorithm", &opt) < 0)
+ goto out;
+ if (opt &&
+ virTypedParamsAddString(¶ms, &nparams, &maxparams,
+ VIR_MIGRATE_PARAM_COMPRESSION_ALGORITHM, opt) < 0)
+ goto save_error;
+
if (vshCommandOptStringReq(ctl, cmd, "xml", &opt) < 0)
goto out;
if (opt) {
--
2.25.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。