Commit 9d2bc236 authored by Anya Harter's avatar Anya Harter Committed by Katerina Koukiou

Implement GetXMLDesc method for Interface Interface

Signed-off-by: 's avatarAnya Harter <aharter@redhat.com>
Reviewed-by: 's avatarKaterina Koukiou <kkoukiou@redhat.com>
parent de0d09e7
......@@ -13,6 +13,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"/>
......
......@@ -70,6 +70,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,
......@@ -97,6 +124,7 @@ static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] = {
static virtDBusGDBusMethodTable virtDBusInterfaceMethodTable[] = {
{ "Create", virtDBusInterfaceCreate },
{ "Destroy", virtDBusInterfaceDestroy },
{ "GetXMLDesc", virtDBusInterfaceGetXMLDesc },
{ "Undefine", virtDBusInterfaceUndefine },
{ 0 }
};
......
......@@ -21,5 +21,9 @@ class TestInterface(libvirttest.BaseTestClass):
interface_obj.Destroy(0)
interface_obj.Create(0)
def test_interface_get_xml_description(self):
_,interface_obj = self.interface_create()
assert isinstance(interface_obj.GetXMLDesc(0), dbus.String)
if __name__ == '__main__':
libvirttest.run()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment