[PATCH 08/16] virsh: Add helper method to retrieve xml from NWFilter def

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: K Shiva Kiran <shiva_kr@xxxxxxxxxx>
---
 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





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux