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

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

 



Signed-off-by: Anya Harter <aharter@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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