提交 431e7366 编写于 作者: P Peter Krempa

virsh: detach-disk: Add --print-xml switch

Similarly to other commands add an argument which allows to check the
XML which would be used to execute the operation instead.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
上级 d70d07ee
...@@ -12432,6 +12432,10 @@ static const vshCmdOptDef opts_detach_disk[] = { ...@@ -12432,6 +12432,10 @@ static const vshCmdOptDef opts_detach_disk[] = {
VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_CONFIG,
VIRSH_COMMON_OPT_DOMAIN_LIVE, VIRSH_COMMON_OPT_DOMAIN_LIVE,
VIRSH_COMMON_OPT_DOMAIN_CURRENT, VIRSH_COMMON_OPT_DOMAIN_CURRENT,
{.name = "print-xml",
.type = VSH_OT_BOOL,
.help = N_("print XML document rather than attach the interface")
},
{.name = NULL} {.name = NULL}
}; };
...@@ -12487,6 +12491,12 @@ cmdDetachDisk(vshControl *ctl, const vshCmd *cmd) ...@@ -12487,6 +12491,12 @@ cmdDetachDisk(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
} }
if (vshCommandOptBool(cmd, "print-xml")) {
vshPrint(ctl, "%s", disk_xml);
functionReturn = true;
goto cleanup;
}
if (flags != 0 || current) if (flags != 0 || current)
ret = virDomainDetachDeviceFlags(dom, disk_xml, flags); ret = virDomainDetachDeviceFlags(dom, disk_xml, flags);
else else
......
...@@ -3113,6 +3113,7 @@ I<--persistent>. ...@@ -3113,6 +3113,7 @@ I<--persistent>.
=item B<detach-disk> I<domain> I<target> =item B<detach-disk> I<domain> I<target>
[[[I<--live>] [I<--config>] | [I<--current>]] | [I<--persistent>]] [[[I<--live>] [I<--config>] | [I<--current>]] | [I<--persistent>]]
[I<--print-xml>]
Detach a disk device from a domain. The I<target> is the device as seen Detach a disk device from a domain. The I<target> is the device as seen
from the domain. from the domain.
...@@ -3130,6 +3131,9 @@ an offline domain, and like I<--live> I<--config> for a running domain. ...@@ -3130,6 +3131,9 @@ an offline domain, and like I<--live> I<--config> for a running domain.
Note that older versions of virsh used I<--config> as an alias for Note that older versions of virsh used I<--config> as an alias for
I<--persistent>. I<--persistent>.
If B<--print-xml> is specified, then the XML which would be used to detach the
disk is printed instead.
=item B<detach-interface> I<domain> I<type> [I<--mac mac>] =item B<detach-interface> I<domain> I<type> [I<--mac mac>]
[[[I<--live>] [I<--config>] | [I<--current>]] | [I<--persistent>]] [[[I<--live>] [I<--config>] | [I<--current>]] | [I<--persistent>]]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册