[libvirt] [dbus PATCH] Implement Undefine method for NWFilter Interface

Katerina Koukiou kkoukiou at redhat.com
Mon Jun 11 12:48:16 UTC 2018


Signed-off-by: Katerina Koukiou <kkoukiou at redhat.com>
---
All other NWFilter APIs are merged but I forgot this one as Jano
noticed.

 data/org.libvirt.NWFilter.xml |  4 ++++
 src/nwfilter.c                | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/data/org.libvirt.NWFilter.xml b/data/org.libvirt.NWFilter.xml
index 69e3357..b8aae02 100644
--- a/data/org.libvirt.NWFilter.xml
+++ b/data/org.libvirt.NWFilter.xml
@@ -19,5 +19,9 @@
       <arg name="flags" type="u" direction="in"/>
       <arg name="xml" type="s" direction="out"/>
     </method>
+    <method name="Undefine">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterUndefine"/>
+    </method>
   </interface>
 </node>
diff --git a/src/nwfilter.c b/src/nwfilter.c
index acfbdd5..3fc6e12 100644
--- a/src/nwfilter.c
+++ b/src/nwfilter.c
@@ -92,6 +92,26 @@ virtDBusNWFilterGetXMLDesc(GVariant *inArgs,
     *outArgs = g_variant_new("(s)", xml);
 }
 
+static void
+virtDBusNWFilterUndefine(GVariant *inArgs G_GNUC_UNUSED,
+                         GUnixFDList *inFDs G_GNUC_UNUSED,
+                         const gchar *objectPath,
+                         gpointer userData,
+                         GVariant **outArgs G_GNUC_UNUSED,
+                         GUnixFDList **outFDs G_GNUC_UNUSED,
+                         GError **error)
+{
+    virtDBusConnect *connect = userData;
+    g_autoptr(virNWFilter) nwfilter = NULL;
+
+    nwfilter = virtDBusNWFilterGetVirNWFilter(connect, objectPath, error);
+    if (!nwfilter)
+        return;
+
+    if (virNWFilterUndefine(nwfilter) < 0)
+        virtDBusUtilSetLastVirtError(error);
+}
+
 static virtDBusGDBusPropertyTable virtDBusNWFilterPropertyTable[] = {
     { "Name", virtDBusNWFilterGetName, NULL },
     { "UUID", virtDBusNWFilterGetUUID, NULL },
@@ -100,6 +120,7 @@ static virtDBusGDBusPropertyTable virtDBusNWFilterPropertyTable[] = {
 
 static virtDBusGDBusMethodTable virtDBusNWFilterMethodTable[] = {
     { "GetXMLDesc", virtDBusNWFilterGetXMLDesc },
+    { "Undefine", virtDBusNWFilterUndefine},
     { 0 }
 };
 
-- 
2.15.0




More information about the libvir-list mailing list