[libvirt] [dbus PATCH 13/15] Implement Destroy method for Interface Interface

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


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

diff --git a/data/org.libvirt.Interface.xml b/data/org.libvirt.Interface.xml
index f62346a..16caba1 100644
--- a/data/org.libvirt.Interface.xml
+++ b/data/org.libvirt.Interface.xml
@@ -22,5 +22,10 @@
         value="See https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceCreate"/>
       <arg name="flags" type="u" direction="in"/>
     </method>
+    <method name="Destroy">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceDestroy"/>
+      <arg name="flags" type="u" direction="in"/>
+    </method>
   </interface>
 </node>
diff --git a/src/interface.c b/src/interface.c
index dec980a..54a4c6b 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -110,6 +110,29 @@ virtDBusInterfaceCreate(GVariant *inArgs,
         virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusInterfaceDestroy(GVariant *inArgs,
+                         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;
+    guint flags;
+
+    g_variant_get(inArgs, "(u)", &flags);
+
+    interface = virtDBusInterfaceGetVirInterface(connect, objectPath, error);
+    if (!interface)
+        return;
+
+    if (virInterfaceDestroy(interface, flags) < 0)
+        virtDBusUtilSetLastVirtError(error);
+}
+
 static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] = {
     { "Active", virtDBusInterfaceGetActive, NULL },
     { "MACString", virtDBusInterfaceGetMACString, NULL },
@@ -119,6 +142,7 @@ static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] = {
 
 static virtDBusGDBusMethodTable virtDBusInterfaceMethodTable[] = {
     { "Create", virtDBusInterfaceCreate },
+    { "Destroy", virtDBusInterfaceDestroy },
     { 0 }
 };
 
-- 
2.17.1




More information about the libvir-list mailing list