This method is not tested for now since the test driver doesn't suport this API. Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- 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 b620939..83e37bc 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#virDomainDestroyFlags"/> <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#virDomainDetachDeviceFlags"/> + <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#virDomainListGetStats"/> diff --git a/src/domain.c b/src/domain.c index cfdd820..cd44d6b 100644 --- a/src/domain.c +++ b/src/domain.c @@ -362,6 +362,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) == -1) + return virtDBusUtilSetLastVirtError(error); +} + G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainStatsRecordPtr, virDomainStatsRecordListFree); static void @@ -638,6 +662,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = { { "AttachDevice", virtDBusDomainAttachDevice }, { "Create", virtDBusDomainCreate }, { "Destroy", virtDBusDomainDestroy }, + { "DetachDevice", virtDBusDomainDetachDevice }, { "GetStats", virtDBusDomainGetStats }, { "GetVcpus", virtDBusDomainGetVcpus }, { "GetXMLDesc", virtDBusDomainGetXMLDesc }, -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list