mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-06 20:00:05 +00:00
virsh: cmdBlockcopy: Add '--print-xml' flag
Useful for knowing how to construct the XML and debugging. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
f0c3398bc4
commit
69ee066523
@ -1232,7 +1232,7 @@ blockcopy
|
||||
[--shallow] [--reuse-external] [bandwidth]
|
||||
[--wait [--async] [--verbose]] [{--pivot | --finish}]
|
||||
[--timeout seconds] [granularity] [buf-size] [--bytes]
|
||||
[--transient-job] [--synchronous-writes]
|
||||
[--transient-job] [--synchronous-writes] [--print-xml]
|
||||
|
||||
Copy a disk backing image chain to a destination. Either *dest* as
|
||||
the destination file name, or *--xml* with the name of an XML file containing
|
||||
@ -1297,6 +1297,8 @@ to be propagated both to the original image and to the destination of the copy
|
||||
so that it's guaranteed that the job converges if the destination storage is
|
||||
slower. This may impact performance of writes while the blockjob is running.
|
||||
|
||||
If *--print-xml* is specified, then the XML used to start the block copy job
|
||||
is printed instead of starting the job.
|
||||
|
||||
blockjob
|
||||
--------
|
||||
|
@ -2332,6 +2332,10 @@ static const vshCmdOptDef opts_blockcopy[] = {
|
||||
.type = VSH_OT_BOOL,
|
||||
.help = N_("the copy job forces guest writes to be synchronously written to the destination")
|
||||
},
|
||||
{.name = "print-xml",
|
||||
.type = VSH_OT_BOOL,
|
||||
.help = N_("print the XML used to start the copy job instead of starting the job")
|
||||
},
|
||||
{.name = NULL}
|
||||
};
|
||||
|
||||
@ -2360,6 +2364,7 @@ cmdBlockcopy(vshControl *ctl, const vshCmd *cmd)
|
||||
int abort_flags = 0;
|
||||
const char *xml = NULL;
|
||||
char *xmlstr = NULL;
|
||||
bool print_xml = vshCommandOptBool(cmd, "print-xml");
|
||||
virTypedParameterPtr params = NULL;
|
||||
virshBlockJobWaitData *bjWait = NULL;
|
||||
int nparams = 0;
|
||||
@ -2437,7 +2442,7 @@ cmdBlockcopy(vshControl *ctl, const vshCmd *cmd)
|
||||
}
|
||||
|
||||
if (granularity || buf_size || (format && STRNEQ(format, "raw")) || xml ||
|
||||
transientjob || syncWrites) {
|
||||
transientjob || syncWrites || print_xml) {
|
||||
/* New API */
|
||||
if (bandwidth || granularity || buf_size) {
|
||||
params = g_new0(virTypedParameter, 3);
|
||||
@ -2492,6 +2497,12 @@ cmdBlockcopy(vshControl *ctl, const vshCmd *cmd)
|
||||
xmlstr = virBufferContentAndReset(&buf);
|
||||
}
|
||||
|
||||
if (print_xml) {
|
||||
vshPrint(ctl, "%s", xmlstr);
|
||||
ret = true;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virDomainBlockCopy(dom, path, xmlstr, params, nparams, flags) < 0)
|
||||
goto cleanup;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user