1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-30 18:50:18 +03:00

virsh: add --image-format option to the save command

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@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
Pavel Hrdina 2025-03-20 23:34:44 +01:00
parent 73cf89e8f2
commit ddb8305049
2 changed files with 17 additions and 0 deletions

View File

@ -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

View File

@ -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(&params, &nparams, &maxparams,
VIR_DOMAIN_SAVE_PARAM_IMAGE_FORMAT, format) < 0)
goto out;
if (vshCommandOptString(ctl, cmd, "xml", &xmlfile) < 0)
goto out;