[libvirt RFCv11 33/33] tools: add parallel-compression parameter to virsh save command

Claudio Fontana cfontana at suse.de
Tue Jun 7 09:19:36 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 5abb03be9a..19fe94ed73 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -3811,6 +3811,7 @@ save
 
    save domain state-file [--bypass-cache] [--xml file]
       [--parallel] [--parallel-connections connections]
+      [--parallel-compression algo]
       [{--running | --paused}] [--verbose]
 
 Saves a running domain (RAM, but not disk state) to a state file so that
@@ -3849,6 +3850,9 @@ can be set using *--parallel-connections*.
 
 Parallel connections help in speeding up large save operations.
 
+*--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 98a1825c98..dfb62b592e 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 extra connections to use 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.26.2



More information about the libvir-list mailing list