[dbus PATCH 15/15] Implement GetXMLDesc 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 |  6 ++++++
 src/interface.c                | 28 ++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/data/org.libvirt.Interface.xml b/data/org.libvirt.Interface.xml
index 5ca366c..efe59e3 100644
--- a/data/org.libvirt.Interface.xml
+++ b/data/org.libvirt.Interface.xml
@@ -27,6 +27,12 @@
         value="See https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceDestroy"/>
       <arg name="flags" type="u" direction="in"/>
     </method>
+    <method name="GetXMLDesc">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceGetXMLDesc"/>
+      <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-interface.html#virInterfaceUndefine"/>
diff --git a/src/interface.c b/src/interface.c
index 07e1aba..83dbdbe 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -133,6 +133,33 @@ virtDBusInterfaceDestroy(GVariant *inArgs,
         virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusInterfaceGetXMLDesc(GVariant *inArgs,
+                            GUnixFDList *inFDs G_GNUC_UNUSED,
+                            const gchar *objectPath,
+                            gpointer userData,
+                            GVariant **outArgs,
+                            GUnixFDList **outFDs G_GNUC_UNUSED,
+                            GError **error)
+{
+    virtDBusConnect *connect = userData;
+    g_autoptr(virInterface) interface = NULL;
+    g_autofree gchar *xml = NULL;
+    guint flags;
+
+    g_variant_get(inArgs, "(u)", &flags);
+
+    interface = virtDBusInterfaceGetVirInterface(connect, objectPath, error);
+    if (!interface)
+        return;
+
+    xml = virInterfaceGetXMLDesc(interface, flags);
+    if (!xml)
+        return virtDBusUtilSetLastVirtError(error);
+
+    *outArgs = g_variant_new("(s)", xml);
+}
+
 static void
 virtDBusInterfaceUndefine(GVariant *inArgs G_GNUC_UNUSED,
                           GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -163,6 +190,7 @@ static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] = {
 static virtDBusGDBusMethodTable virtDBusInterfaceMethodTable[] = {
     { "Create", virtDBusInterfaceCreate },
     { "Destroy", virtDBusInterfaceDestroy },
+    { "GetXMLDesc", virtDBusInterfaceGetXMLDesc },
     { "Undefine", virtDBusInterfaceUndefine },
     { 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