Signed-off-by: Anya Harter <aharter(a)redhat.com>
---
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#virInterfaceDestr...
<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#virInterfaceGetXM...
+ <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#virInterfaceUndef...
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