[libvirt RFCv10 32/32] tools: add parallel-compression parameter to virsh save command

Claudio Fontana cfontana at suse.de
Sun May 15 09:49:28 UTC 2022


this completes the save side of the parallel compression support.

Signed-off-by: Claudio Fontana <cfontana at suse.de>
---
 docs/manpages/virsh.rst |  4 ++++
 tools/virsh-domain.c    | 12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index dee748d870..5518e78160 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -3812,6 +3812,7 @@ save
 
    save domain state-file [--bypass-cache] [--xml file]
       [--parallel] [--parallel-connections connections]
+      [--parallel-compression algo]
       [{--running | --paused}] [--verbose]
 
 Saves a paused or running domain (RAM, but not disk state) to one or more
@@ -3852,6 +3853,9 @@ set using *--parallel-connections*, which will save to files named
 
 Parallel connections may help in speeding up the save operation.
 
+*--parallel-compression* can be used to ask the hypervisor to provide
+compressed channels in the save stream using algorithm ``algo``.
+
 Domain saved state files assume that disk images will be unchanged
 between the creation and restore point.  For a more complete system
 restore point, where the disk state is saved alongside the memory
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 9103d6ed65..254d082e36 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -4182,6 +4182,10 @@ static const vshCmdOptDef opts_save[] = {
      .type = VSH_OT_INT,
      .help = N_("number of connections/files for parallel save")
     },
+    {.name = "parallel-compression",
+     .type = VSH_OT_STRING,
+     .help = N_("compression algorithm and format for parallel save")
+    },
     {.name = "xml",
      .type = VSH_OT_STRING,
      .completer = virshCompletePathLocalExisting,
@@ -4211,6 +4215,7 @@ doSave(void *opaque)
     g_autoptr(virshDomain) dom = NULL;
     const char *name = NULL;
     const char *to = NULL;
+    const char *pcomp = NULL;
     virTypedParameterPtr params = NULL;
     int nparams = 0;
     int maxparams = 0;
@@ -4246,6 +4251,13 @@ doSave(void *opaque)
                                  VIR_DOMAIN_SAVE_PARAM_PARALLEL_CONNECTIONS, intOpt) < 0)
             goto out;
     }
+    if ((rv = vshCommandOptStringReq(ctl, cmd, "parallel-compression", &pcomp)) < 0) {
+        goto out;
+    } else {
+        if (virTypedParamsAddString(&params, &nparams, &maxparams,
+                                    VIR_DOMAIN_SAVE_PARAM_PARALLEL_COMPRESSION, pcomp) < 0)
+            goto out;
+    }
     if (vshCommandOptBool(cmd, "running"))
         flags |= VIR_DOMAIN_SAVE_RUNNING;
     if (vshCommandOptBool(cmd, "paused"))
-- 
2.35.3



More information about the libvir-list mailing list