From: Pavel Hrdina <phrdina(a)redhat.com>
Option --parallel-channels would require changing configuration file to
be used so introduce this option as well to make it convenient for
users.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
docs/manpages/virsh.rst | 5 +++++
tools/virsh-domain.c | 12 ++++++++++++
2 files changed, 17 insertions(+)
diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 65ec03cf20..35ae6af547 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -4179,6 +4179,7 @@ save
::
save domain state-file [--bypass-cache] [--xml file]
+ [--image-format format]
[--parallel-channels channels]
[{--running | --paused}] [--verbose]
@@ -4213,6 +4214,10 @@ based on the state the domain was in when the save was done;
passing
either the *--running* or *--paused* flag will allow overriding which
state the ``restore`` should use.
+*--image-format* option can change the default image format used to
+save data into file. For more details consult the qemu.conf configuration
+file.
+
*--parallel-channels* option can specify number of parallel IO channels
to be used when saving memory to file. Using parallel IO channels requires
the use of ``sparse`` image save format. Parallel save may significantly
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 98f0e60ed4..ceff6789d8 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -4534,6 +4534,10 @@ static const vshCmdOptDef opts_save[] = {
.type = VSH_OT_INT,
.help = N_("number of IO channels to use for parallel save")
},
+ {.name = "image-format",
+ .type = VSH_OT_STRING,
+ .help = N_("format of the save image file")
+ },
{.name = "xml",
.type = VSH_OT_STRING,
.unwanted_positional = true,
@@ -4570,6 +4574,7 @@ doSave(void *opaque)
int nchannels = 0;
unsigned int flags = 0;
const char *xmlfile = NULL;
+ const char *format = NULL;
g_autofree char *xml = NULL;
int rc;
#ifndef WIN32
@@ -4598,6 +4603,13 @@ doSave(void *opaque)
VIR_DOMAIN_SAVE_PARAM_PARALLEL_CHANNELS, nchannels) < 0)
goto out;
+ if (vshCommandOptString(ctl, cmd, "image-format", &format) < 0)
+ goto out;
+ if (format &&
+ virTypedParamsAddString(¶ms, &nparams, &maxparams,
+ VIR_DOMAIN_SAVE_PARAM_IMAGE_FORMAT, format) < 0)
+ goto out;
+
if (vshCommandOptString(ctl, cmd, "xml", &xmlfile) < 0)
goto out;
--
2.48.1