]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Add migrate options to set parallel compress level
authorJiang Jiacheng <jiangjiacheng@huawei.com>
Fri, 24 Feb 2023 09:27:11 +0000 (17:27 +0800)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 18 May 2023 13:47:30 +0000 (15:47 +0200)
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@huawei.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
docs/manpages/virsh.rst
tools/virsh-domain.c

index c3014f7b0682b210faa513847a75211862bb6136..f4e5a0bd62a10290bff15dcd0fcfef71f7bb35f0 100644 (file)
@@ -3372,7 +3372,8 @@ migrate
       [--xml file] [--migrate-disks disk-list] [--disks-port port]
       [--compressed] [--comp-methods method-list]
       [--comp-mt-level] [--comp-mt-threads] [--comp-mt-dthreads]
-      [--comp-xbzrle-cache] [--auto-converge] [auto-converge-initial]
+      [--comp-xbzrle-cache] [--comp-zlib-level] [--comp-zstd-level]
+      [--auto-converge] [auto-converge-initial]
       [auto-converge-increment] [--persistent-xml file] [--tls]
       [--postcopy-bandwidth bandwidth]
       [--parallel [--parallel-connections connections]]
@@ -3479,14 +3480,25 @@ to post-copy upon timeout; migration has to be started with *--postcopy*
 option for this to work.
 
 *--compressed* activates compression, the compression method is chosen
-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.
+with *--comp-methods*. Supported methods are "mt", "xbzrle", "zlib",
+and "zstd". The supported set of methods and their combinations depend
+on a hypervisor and migration options. QEMU only supports "zlib" and
+"zstd" methods when *--parallel* is used and they cannot be used at
+once. When no methods are specified, a hypervisor default methods will
+be used. QEMU defaults to "xbzrle" as long as *--parallel* is not used.
+For *--parallel* migrations QEMU does not provide any default compression
+method and thus it has to be specified explicitly using *--comp-method*.
+Compression methods can be tuned further. *--comp-mt-level* sets
+compression level for "mt" method. 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. *--comp-zlib-level* sets the compression
+level when using "zlib" method. Values are in range from 0 to 9 and defaults
+to 1, where 0 is no compression, 1 is maximum speed and 9 is maximum
+compression. *--comp-zstd-level* sets the compression level when using "zstd"
+method. Values are in range from 0 to 20 and defaults to 1, where 0 is no
+compression, 1 is maximum speed and 20 is maximum compression.
 
 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
index ffa586940d2f553d9eedf448b516bf6ce44198ea..fb54562eb6e0dad17c1065152ceaffb215f0a518 100644 (file)
@@ -11076,6 +11076,14 @@ static const vshCmdOptDef opts_migrate[] = {
      .completer = virshCompleteEmpty,
      .help = N_("override the destination host name used for TLS verification")
     },
+    {.name = "comp-zlib-level",
+     .type = VSH_OT_INT,
+     .help = N_("compress level for zlib compression")
+    },
+    {.name = "comp-zstd-level",
+     .type = VSH_OT_INT,
+     .help = N_("compress level for zstd compression")
+    },
     {.name = NULL}
 };
 
@@ -11288,6 +11296,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) {