Signed-off-by: K Shiva Kiran <shiva_kr@riseup.net>
---
tools/virsh-util.c | 25 +++++++++++++++++++++++++
tools/virsh-util.h | 9 +++++++++
2 files changed, 34 insertions(+)
diff --git a/tools/virsh-util.c b/tools/virsh-util.c
index fb6327613a..c3af770c29 100644
--- a/tools/virsh-util.c
+++ b/tools/virsh-util.c
@@ -423,6 +423,31 @@ virshNetworkGetXMLFromNet(vshControl *ctl,
}
+int
+virshNWFilterGetXMLFromNWFilter(vshControl *ctl,
+ virNWFilterPtr nwfilter,
+ unsigned int flags,
+ xmlDocPtr *xml,
+ xmlXPathContextPtr *ctxt)
+{
+ g_autofree char *desc = NULL;
+
+ if (!(desc = virNWFilterGetXMLDesc(nwfilter, flags))) {
+ vshError(ctl, _("Failed to get nwfilter description xml"));
+ return -1;
+ }
+
+ *xml = virXMLParseStringCtxt(desc, _("(nwfilter_definition)"), ctxt);
+
+ if (!(*xml)) {
+ vshError(ctl, _("Failed to parse nwfilter description xml"));
+ return -1;
+ }
+
+ return 0;
+}
+
+
int
virshDomainGetXML(vshControl *ctl,
const vshCmd *cmd,
diff --git a/tools/virsh-util.h b/tools/virsh-util.h
index 2386847072..4cad3d7eb9 100644
--- a/tools/virsh-util.h
+++ b/tools/virsh-util.h
@@ -152,6 +152,15 @@ virshNetworkGetXMLFromNet(vshControl *ctl,
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4)
ATTRIBUTE_NONNULL(5) G_GNUC_WARN_UNUSED_RESULT;
+int
+virshNWFilterGetXMLFromNWFilter(vshControl *ctl,
+ virNWFilterPtr nwfilter,
+ unsigned int flags,
+ xmlDocPtr *xml,
+ xmlXPathContextPtr *ctxt)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4)
+ ATTRIBUTE_NONNULL(5) G_GNUC_WARN_UNUSED_RESULT;
+
int
virshDomainGetXML(vshControl *ctl,
const vshCmd *cmd,
--
2.42.0