Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
docs/manpages/virsh.rst | 5 ++++-
tools/virsh-domain.c | 9 +++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 09fc1f67ad..14ed9cd5a0 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -1890,7 +1890,7 @@ domif-setlink
::
- domif-setlink domain interface-device state [--config]
+ domif-setlink domain interface-device state [--config] [--print-xml]
Modify link state of the domain's virtual interface. Possible values for
state are "up" and "down". If *--config* is specified, only the
persistent
@@ -1898,6 +1898,9 @@ configuration of the domain is modified, for compatibility
purposes,
*--persistent* is alias of *--config*.
*interface-device* can be the interface's target name or the MAC address.
+If *--print-xml* is specified, then the XML used to update the interface is
+printed instead.
+
domifaddr
---------
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 87de3a708a..9baab2672a 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -3120,6 +3120,10 @@ static const vshCmdOptDef opts_domif_setlink[] = {
.help = "config"
},
VIRSH_COMMON_OPT_DOMAIN_CONFIG,
+ {.name = "print-xml",
+ .type = VSH_OT_BOOL,
+ .help = N_("print XML document rather than set the interface link state")
+ },
{.name = NULL}
};
@@ -3238,6 +3242,11 @@ cmdDomIfSetLink(vshControl *ctl, const vshCmd *cmd)
return false;
}
+ if (vshCommandOptBool(cmd, "print-xml")) {
+ vshPrint(ctl, "%s", xml_buf);
+ return true;
+ }
+
if (virDomainUpdateDeviceFlags(dom, xml_buf, flags) < 0) {
vshError(ctl, _("Failed to update interface link state"));
return false;
--
2.38.1