[PATCH 4/4] virsh: Add migrate options to set parallel compress level

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

 



Add migrate options: --compression-zlib-level
                     --compression-zstd-level
These options are used to set compress level for "zlib"
or "zstd" during parallel migration if the compress method
is specified.

Signed-off-by: Jiang Jiacheng <jiangjiacheng@xxxxxxxxxx>
---
 docs/manpages/virsh.rst | 22 +++++++++++++++-------
 tools/virsh-domain.c    | 26 ++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index d5b614dc03..a837e3c1af 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]
+      [--comp-zlib-level][--comp-zstd-level]]
       [--bandwidth bandwidth] [--tls-destination hostname]
       [--disks-uri URI] [--copy-storage-synchronous-writes]
 
@@ -3466,11 +3467,14 @@ option for this to work.
 with *--comp-methods*. Supported methods are "mt" and "xbzrle" and
 can be used in any combination. When no methods are specified, a hypervisor
 default methods will be used. QEMU defaults to "xbzrle". Compression methods
-can be tuned further. *--comp-mt-level* sets compression level.
-Values are in range from 0 to 9, where 1 is maximum speed and 9 is maximum
-compression. *--comp-mt-threads* and *--comp-mt-dthreads* set the number
-of compress threads on source and the number of decompress threads on target
-respectively. *--comp-xbzrle-cache* sets size of page cache in bytes.
+can be tuned further. When used with --parallel, supported methods are "zlib"
+and "zstd" and if no methods are specified, QEMU will deaults to "none".
+Note that compression method is defferent from compress migration and multifd
+migration. *--comp-mt-level* sets compression level. Values are in range from
+0 to 9, where 1 is maximum speed and 9 is maximum compression.
+*--comp-mt-threads* and *--comp-mt-dthreads* set the number of compress threads
+on source and the number of decompress threads on target respectively.
+*--comp-xbzrle-cache* sets size of page cache in bytes.
 
 Providing *--tls* causes the migration to use the host configured TLS setup
 (see migrate_tls_x509_cert_dir in /etc/libvirt/qemu.conf) in order to perform
@@ -3486,7 +3490,11 @@ 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. *--comp-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. *--comp-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..bcf03e9567 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -11095,6 +11095,14 @@ static const vshCmdOptDef opts_migrate[] = {
      .type = VSH_OT_INT,
      .help = N_("number of connections for parallel migration")
     },
+    {.name = "comp-zlib-level",
+     .type = VSH_OT_INT,
+     .help = N_("zlib compression level used in parallel migration")
+    },
+    {.name = "comp-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 +11334,24 @@ doMigrate(void *opaque)
             goto save_error;
     }
 
+    if ((rv = vshCommandOptInt(ctl, cmd, "comp-zlib-level", &intOpt)) < 0) {
+        goto out;
+    } else if (rv > 0) {
+        if (virTypedParamsAddInt(&params, &nparams, &maxparams,
+                                 VIR_MIGRATE_PARAM_COMPRESSION_ZLIB_LEVEL,
+                                 intOpt) < 0)
+            goto save_error;
+    }
+
+    if ((rv = vshCommandOptInt(ctl, cmd, "comp-zstd-level", &intOpt)) < 0) {
+        goto out;
+    } else if (rv > 0) {
+        if (virTypedParamsAddInt(&params, &nparams, &maxparams,
+                                 VIR_MIGRATE_PARAM_COMPRESSION_ZSTD_LEVEL,
+                                 intOpt) < 0)
+            goto save_error;
+    }
+
     if ((rv = vshCommandOptULongLong(ctl, cmd, "bandwidth", &ullOpt)) < 0) {
         goto out;
     } else if (rv > 0) {
-- 
2.33.0





[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