Signed-off-by: Anya Harter <aharter(a)redhat.com>
---
data/org.libvirt.Interface.xml | 4 ++++
src/interface.c | 21 +++++++++++++++++++++
tests/test_interface.py | 5 +++++
3 files changed, 30 insertions(+)
diff --git a/data/org.libvirt.Interface.xml b/data/org.libvirt.Interface.xml
index f5ec281..4534b97 100644
--- a/data/org.libvirt.Interface.xml
+++ b/data/org.libvirt.Interface.xml
@@ -13,5 +13,9 @@
value="See
https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceDestr...
<arg name="flags" type="u" direction="in"/>
</method>
+ <method name="Undefine">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceUndef...
+ </method>
</interface>
</node>
diff --git a/src/interface.c b/src/interface.c
index 077b10d..a2d1cef 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -70,6 +70,26 @@ virtDBusInterfaceDestroy(GVariant *inArgs,
virtDBusUtilSetLastVirtError(error);
}
+static void
+virtDBusInterfaceUndefine(GVariant *inArgs G_GNUC_UNUSED,
+ 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;
+
+ interface = virtDBusInterfaceGetVirInterface(connect, objectPath, error);
+ if (!interface)
+ return;
+
+ if (virInterfaceUndefine(interface) < 0)
+ virtDBusUtilSetLastVirtError(error);
+}
+
static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] = {
{ 0 }
};
@@ -77,6 +97,7 @@ static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] = {
static virtDBusGDBusMethodTable virtDBusInterfaceMethodTable[] = {
{ "Create", virtDBusInterfaceCreate },
{ "Destroy", virtDBusInterfaceDestroy },
+ { "Undefine", virtDBusInterfaceUndefine },
{ 0 }
};
diff --git a/tests/test_interface.py b/tests/test_interface.py
index 62fd517..4a83672 100755
--- a/tests/test_interface.py
+++ b/tests/test_interface.py
@@ -7,6 +7,11 @@ class TestInterface(libvirttest.BaseTestClass):
""" Tests for methods and properties of the Interface interface
"""
+ def test_interface_undefine(self):
+ _,interface_obj = self.interface_create()
+ interface_obj.Destroy(0)
+ interface_obj.Undefine(0)
+
def test_interface_destroy(self):
_,interface_obj = self.interface_create()
interface_obj.Destroy(0)
--
2.17.1