[libvirt] [dbus PATCH 14/15] Implement Undefine method for Interface Interface

Anya Harter aharter at redhat.com
Fri Jul 6 21:36:54 UTC 2018


Signed-off-by: Anya Harter <aharter at redhat.com>
---
 data/org.libvirt.Interface.xml |  4 ++++
 src/interface.c                | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/data/org.libvirt.Interface.xml b/data/org.libvirt.Interface.xml
index 16caba1..5ca366c 100644
--- a/data/org.libvirt.Interface.xml
+++ b/data/org.libvirt.Interface.xml
@@ -27,5 +27,9 @@
         value="See https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceDestroy"/>
       <arg name="flags" type="u" direction="in"/>
     </method>
+    <method name="Undefine">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceUndefine"/>
+    </method>
   </interface>
 </node>
diff --git a/src/interface.c b/src/interface.c
index 54a4c6b..07e1aba 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -133,6 +133,26 @@ virtDBusInterfaceDestroy(GVariant *inArgs,
         virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusInterfaceUndefine(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(virInterface) interface = NULL;
+
+    interface = virtDBusInterfaceGetVirInterface(connect, objectPath, error);
+    if (!interface)
+        return;
+
+    if (virInterfaceUndefine(interface) < 0)
+        virtDBusUtilSetLastVirtError(error);
+}
+
 static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] = {
     { "Active", virtDBusInterfaceGetActive, NULL },
     { "MACString", virtDBusInterfaceGetMACString, NULL },
@@ -143,6 +163,7 @@ static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] = {
 static virtDBusGDBusMethodTable virtDBusInterfaceMethodTable[] = {
     { "Create", virtDBusInterfaceCreate },
     { "Destroy", virtDBusInterfaceDestroy },
+    { "Undefine", virtDBusInterfaceUndefine },
     { 0 }
 };
 
-- 
2.17.1




More information about the libvir-list mailing list