From 79cc0d503673d713fb23e699e850dc5a6dcc1a27 Mon Sep 17 00:00:00 2001 From: mayunlong Date: Tue, 14 Feb 2023 19:23:38 +0800 Subject: [PATCH] libvirt update to version 6.2.0-51 live_migrate: virsh migrate command supports the zstd compression algorithm glibcompat: Provide implementation for G_GNUC_NO_INLINE Signed-off-by:mayunlong (cherry picked from commit c952820128195c96f548160bd830e10ec8a9c9be) --- ...de-implementation-for-G_GNUC_NO_INLI.patch | 70 +++++++++ libvirt.spec | 8 +- ...sh-migrate-command-supports-the-zstd.patch | 137 ++++++++++++++++++ 3 files changed, 214 insertions(+), 1 deletion(-) create mode 100644 glibcompat-Provide-implementation-for-G_GNUC_NO_INLI.patch create mode 100644 live_migrate-virsh-migrate-command-supports-the-zstd.patch diff --git a/glibcompat-Provide-implementation-for-G_GNUC_NO_INLI.patch b/glibcompat-Provide-implementation-for-G_GNUC_NO_INLI.patch new file mode 100644 index 0000000..2c6042f --- /dev/null +++ b/glibcompat-Provide-implementation-for-G_GNUC_NO_INLI.patch @@ -0,0 +1,70 @@ +From 1ac928729853d29d030944ece5e10db69d54267d Mon Sep 17 00:00:00 2001 +From: mayunlong +Date: Tue, 14 Feb 2023 19:09:08 +0800 +Subject: [PATCH] glibcompat: Provide implementation for G_GNUC_NO_INLINE + +Currently, we require glib-2.56.0 at minimum (because of RHEL-8) +but we use G_GNUC_NO_INLINE which was introduced in 2.58.0. While +we provide an implementation for older versions, where the macro +does not exists, it's a bit more tricky than that. Since we +define GLIB_VERSION_MAX_ALLOWED we would get a compile time error +when trying to use something too new, except for G_GNUC_NO_INLINE +which was intentionally not marked as +GLIB_AVAILABLE_MACRO_IN_2_58. But this is about to change with +glib-2.73.2 (which contains commit [1]). + +At the same time, we can't just bump glib and thus we have to +provide an alternative implementation without the version +annotation. + +1: https://gitlab.gnome.org/GNOME/glib/-/commit/a6f8fe071e44b0145619c21f3bfbc90c56ab805e +Signed-off-by: Michal Privoznik +Reviewed-by: Pavel Hrdina +--- + src/internal.h | 12 ------------ + src/util/glibcompat.h | 9 +++++++++ + 2 files changed, 9 insertions(+), 12 deletions(-) + +diff --git a/src/internal.h b/src/internal.h +index 302fddba34..440f01d370 100644 +--- a/src/internal.h ++++ b/src/internal.h +@@ -94,18 +94,6 @@ + # endif + #endif + +-/** +- * G_GNUC_NO_INLINE: +- * +- * Force compiler not to inline a method. Should be used if +- * the method need to be overridable by test mocks. +- * +- * TODO: Remove after upgrading to GLib >= 2.58 +- */ +-#ifndef G_GNUC_NO_INLINE +-# define G_GNUC_NO_INLINE __attribute__((__noinline__)) +-#endif +- + /** + * ATTRIBUTE_PACKED + * +diff --git a/src/util/glibcompat.h b/src/util/glibcompat.h +index 6f50a76f3c..15d3266686 100644 +--- a/src/util/glibcompat.h ++++ b/src/util/glibcompat.h +@@ -37,3 +37,12 @@ char *vir_g_strdup_vprintf(const char *msg, va_list args) + #define g_canonicalize_filename vir_g_canonicalize_filename + #undef g_fsync + #define g_fsync vir_g_fsync ++ ++/* Intentionally redefine macro so that it's not marked as available in 2.58 ++ * and newer. Drop when bumping to 2.58 or newer. */ ++#undef G_GNUC_NO_INLINE ++#if g_macro__has_attribute(__noinline__) ++# define G_GNUC_NO_INLINE __attribute__ ((__noinline__)) ++#else ++# define G_GNUC_NO_INLINE ++#endif +-- +2.25.1 + diff --git a/libvirt.spec b/libvirt.spec index 1347306..8c4f4f8 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -101,7 +101,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 6.2.0 -Release: 50 +Release: 51 License: LGPLv2+ URL: https://libvirt.org/ @@ -466,6 +466,8 @@ Patch0353: remote_daemon-Don-t-run-virStateCleanup-if-virStateR.patch Patch0354: virDomainInputDefValidate-Validate-model.patch Patch0355: virsh-Check-whether-enough-arguments-was-passed-to-i.patch Patch0356: virNetDevSaveNetConfig-Pass-mode-to-virFileWriteStr.patch +Patch0357: live_migrate-virsh-migrate-command-supports-the-zstd.patch +Patch0358: glibcompat-Provide-implementation-for-G_GNUC_NO_INLI.patch Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} @@ -2200,6 +2202,10 @@ exit 0 %changelog +* Tue Feb 14 2023 mayunlong - 6.2.0-51 +- live_migrate: virsh migrate command supports the zstd compression algorithm +- glibcompat: Provide implementation for G_GNUC_NO_INLINE + * Wed Jan 04 2023 jiangjiacheng - 6.2.0-50 - backport patches from upstream diff --git a/live_migrate-virsh-migrate-command-supports-the-zstd.patch b/live_migrate-virsh-migrate-command-supports-the-zstd.patch new file mode 100644 index 0000000..cd0987a --- /dev/null +++ b/live_migrate-virsh-migrate-command-supports-the-zstd.patch @@ -0,0 +1,137 @@ +From f098a118012a298516521b92c7c7ca844c868176 Mon Sep 17 00:00:00 2001 +From: jipengfei +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 +--- + 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 + -- Gitee