[libvirt RFC v2 11/11] qemu: add migration parameter multifd-compression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



use zstd which is the only really interesting one.

Signed-off-by: Claudio Fontana <cfontana@xxxxxxx>
---
 src/qemu/qemu_capabilities.c     |  2 ++
 src/qemu/qemu_capabilities.h     |  1 +
 src/qemu/qemu_migration.c        |  6 ++++
 src/qemu/qemu_migration_params.c | 49 ++++++++++++++++----------------
 src/qemu/qemu_migration_params.h |  6 ++++
 5 files changed, 39 insertions(+), 25 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 01b570807b..9ad34969f7 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -669,6 +669,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
               /* 425 */
               "blockdev.nbd.tls-hostname", /* QEMU_CAPS_BLOCKDEV_NBD_TLS_HOSTNAME */
               "memory-backend-file.prealloc-threads", /* QEMU_CAPS_MEMORY_BACKEND_PREALLOC_THREADS */
+              "migration-param.multifd-compression", /* QEMU_CAPS_MIGRATION_PARAM_MULTIFD_COMPRESSION */
     );
 
 
@@ -1616,6 +1617,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = {
     { "migrate-set-parameters/arg-type/downtime-limit", QEMU_CAPS_MIGRATION_PARAM_DOWNTIME },
     { "migrate-set-parameters/arg-type/xbzrle-cache-size", QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE },
     { "migrate-set-parameters/arg-type/block-bitmap-mapping/bitmaps/transform", QEMU_CAPS_MIGRATION_PARAM_BLOCK_BITMAP_MAPPING },
+    { "migrate-set-parameters/arg-type/multifd-compression", QEMU_CAPS_MIGRATION_PARAM_MULTIFD_COMPRESSION },
     { "nbd-server-start/arg-type/tls-creds", QEMU_CAPS_NBD_TLS },
     { "nbd-server-add/arg-type/bitmap", QEMU_CAPS_NBD_BITMAP },
     { "netdev_add/arg-type/+vhost-vdpa", QEMU_CAPS_NETDEV_VHOST_VDPA },
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 948029d60d..2b0de4113c 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -644,6 +644,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
     /* 425 */
     QEMU_CAPS_BLOCKDEV_NBD_TLS_HOSTNAME, /* tls hostname can be overriden for NBD clients */
     QEMU_CAPS_MEMORY_BACKEND_PREALLOC_THREADS, /* -object memory-backend-*.prealloc-threads */
+    QEMU_CAPS_MIGRATION_PARAM_MULTIFD_COMPRESSION, /* multifd-compression in migrate-set-parameters */
 
     QEMU_CAPS_LAST /* this must always be the last item */
 } virQEMUCapsFlags;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 9ce24c8cfc..65a3343622 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -5949,6 +5949,12 @@ qemuMigrationSrcToFileAux(virQEMUDriver *driver, virDomainObj *vm,
                                       QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS,
                                       nchannels) < 0)
             return -1;
+        if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_PARAM_MULTIFD_COMPRESSION)) {
+            if (qemuMigrationParamsSetString(migParams,
+                                             QEMU_MIGRATION_PARAM_MULTIFD_COMPRESSION,
+                                             "zstd") < 0)
+                return -1;
+        }
     }
 
     if (needParams && qemuMigrationParamsApply(driver, vm, asyncJob, migParams) < 0)
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 36174a66d8..f6b9dc337d 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -115,6 +115,7 @@ VIR_ENUM_IMPL(qemuMigrationParam,
               "xbzrle-cache-size",
               "max-postcopy-bandwidth",
               "multifd-channels",
+              "multifd-compression",
 );
 
 typedef struct _qemuMigrationParamsAlwaysOnItem qemuMigrationParamsAlwaysOnItem;
@@ -234,6 +235,7 @@ static const qemuMigrationParamType qemuMigrationParamTypes[] = {
     [QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE] = QEMU_MIGRATION_PARAM_TYPE_ULL,
     [QEMU_MIGRATION_PARAM_MAX_POSTCOPY_BANDWIDTH] = QEMU_MIGRATION_PARAM_TYPE_ULL,
     [QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS] = QEMU_MIGRATION_PARAM_TYPE_INT,
+    [QEMU_MIGRATION_PARAM_MULTIFD_COMPRESSION] = QEMU_MIGRATION_PARAM_TYPE_STRING,
 };
 G_STATIC_ASSERT(G_N_ELEMENTS(qemuMigrationParamTypes) == QEMU_MIGRATION_PARAM_LAST);
 
@@ -898,31 +900,6 @@ qemuMigrationParamsApply(virQEMUDriver *driver,
 }
 
 
-/**
- * qemuMigrationParamsSetString:
- * @migrParams: migration parameter object
- * @param: parameter to set
- * @value: new value
- *
- * Enables and sets the migration parameter @param in @migrParams. Returns 0 on
- * success and -1 on error. Libvirt error is reported.
- */
-static int
-qemuMigrationParamsSetString(qemuMigrationParams *migParams,
-                             qemuMigrationParam param,
-                             const char *value)
-{
-    if (qemuMigrationParamsCheckType(param, QEMU_MIGRATION_PARAM_TYPE_STRING) < 0)
-        return -1;
-
-    migParams->params[param].value.s = g_strdup(value);
-
-    migParams->params[param].set = true;
-
-    return 0;
-}
-
-
 /* qemuMigrationParamsEnableTLS
  * @driver: pointer to qemu driver
  * @vm: domain object
@@ -1144,6 +1121,28 @@ qemuMigrationParamsSetULL(qemuMigrationParams *migParams,
     return 0;
 }
 
+/**
+ * qemuMigrationParamsSetString:
+ * @migrParams: migration parameter object
+ * @param: parameter to set
+ * @value: new value
+ *
+ * Enables and sets the migration parameter @param in @migrParams. Returns 0 on
+ * success and -1 on error. Libvirt error is reported.
+ */
+int
+qemuMigrationParamsSetString(qemuMigrationParams *migParams,
+                             qemuMigrationParam param,
+                             const char *value)
+{
+    if (qemuMigrationParamsCheckType(param, QEMU_MIGRATION_PARAM_TYPE_STRING) < 0)
+        return -1;
+
+    migParams->params[param].value.s = g_strdup(value);
+    migParams->params[param].set = true;
+    return 0;
+}
+
 
 /**
  * Returns -1 on error,
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
index 99af73b4a4..23a4e0c8a2 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -60,6 +60,7 @@ 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_LAST
 } qemuMigrationParam;
@@ -137,6 +138,11 @@ qemuMigrationParamsSetULL(qemuMigrationParams *migParams,
                           qemuMigrationParam param,
                           unsigned long long value);
 
+int
+qemuMigrationParamsSetString(qemuMigrationParams *migParams,
+                             qemuMigrationParam param,
+                             const char *value);
+
 int
 qemuMigrationParamsGetULL(qemuMigrationParams *migParams,
                           qemuMigrationParam param,
-- 
2.34.1





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux