virsh: Add --print-xml flag for 'vol-clone' command

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa
2022-11-30 16:48:23 +01:00
parent 3584f78d4b
commit 5f3d21abf8
2 changed files with 13 additions and 1 deletions

View File

@@ -559,6 +559,10 @@ static const vshCmdOptDef opts_vol_clone[] = {
.type = VSH_OT_BOOL,
.help = N_("use btrfs COW lightweight copy")
},
{.name = "print-xml",
.type = VSH_OT_BOOL,
.help = N_("print XML document rather than clone the volume")
},
{.name = NULL}
};
@@ -599,6 +603,11 @@ cmdVolClone(vshControl *ctl, const vshCmd *cmd)
return false;
}
if (vshCommandOptBool(cmd, "print-xml")) {
vshPrint(ctl, "%s", newxml);
return true;
}
if (!(newvol = virStorageVolCreateXMLFrom(origpool, (char *) newxml,
origvol, flags))) {
vshError(ctl, _("Failed to clone vol from %s"),