This method is not tested for now since the test driver
doesn't suport this API.
Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Domain.xml | 6 ++++++
src/domain.c | 25 +++++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 9360cbf..5c310ad 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -56,6 +56,12 @@
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDestroyFlag...
<arg name="flags" type="u" direction="in"/>
</method>
+ <method name="DetachDevice">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDetachDevic...
+ <arg name="xml" type="s" direction="in"/>
+ <arg name="flags" type="u" direction="in"/>
+ </method>
<method name="GetStats">
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainListGetStat...
diff --git a/src/domain.c b/src/domain.c
index dccba94..2c3174b 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -366,6 +366,30 @@ virtDBusDomainDestroy(GVariant *inArgs,
virtDBusUtilSetLastVirtError(error);
}
+static void
+virtDBusDomainDetachDevice(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(virDomain) domain = NULL;
+ const gchar *xml;
+ guint flags;
+
+ g_variant_get(inArgs, "(&su)", &xml, &flags);
+
+ domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+ if (!domain)
+ return;
+
+ if (virDomainDetachDeviceFlags(domain, xml, flags) < 0)
+ virtDBusUtilSetLastVirtError(error);
+}
+
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainStatsRecordPtr, virDomainStatsRecordListFree);
static void
@@ -644,6 +668,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
{ "AttachDevice", virtDBusDomainAttachDevice },
{ "Create", virtDBusDomainCreate },
{ "Destroy", virtDBusDomainDestroy },
+ { "DetachDevice", virtDBusDomainDetachDevice },
{ "GetStats", virtDBusDomainGetStats },
{ "GetVcpus", virtDBusDomainGetVcpus },
{ "GetXMLDesc", virtDBusDomainGetXMLDesc },
--
2.15.0