[libvirt] [dbus PATCH 12/15] Implement Create method for Interface Interface

Anya Harter aharter at redhat.com
Fri Jul 6 21:36:52 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 f50bc37..f62346a 100644
--- a/data/org.libvirt.Interface.xml
+++ b/data/org.libvirt.Interface.xml
@@ -17,5 +17,10 @@
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceIsActive"/>
     </property>
+    <method name="Create">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceCreate"/>
+      <arg name="flags" type="u" direction="in"/>
+    </method>
   </interface>
 </node>
diff --git a/src/interface.c b/src/interface.c
index b73e116..dec980a 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -87,6 +87,29 @@ virtDBusInterfaceGetActive(const gchar *objectPath,
     *value = g_variant_new("b", !!active);
 }
 
+static void
+virtDBusInterfaceCreate(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 (virInterfaceCreate(interface, flags) < 0)
+        virtDBusUtilSetLastVirtError(error);
+}
+
 static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] = {
     { "Active", virtDBusInterfaceGetActive, NULL },
     { "MACString", virtDBusInterfaceGetMACString, NULL },
@@ -95,6 +118,7 @@ static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] = {
 };
 
 static virtDBusGDBusMethodTable virtDBusInterfaceMethodTable[] = {
+    { "Create", virtDBusInterfaceCreate },
     { 0 }
 };
 
-- 
2.17.1




More information about the libvir-list mailing list