[libvirt] [dbus PATCH v2 09/22] Implement AbortJob for Domain interface

Katerina Koukiou kkoukiou at redhat.com
Thu Apr 12 14:32:48 UTC 2018


Signed-off-by: Katerina Koukiou <kkoukiou at redhat.com>
---
 data/org.libvirt.Domain.xml |  4 ++++
 src/domain.c                | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 2e0339b..152ed4b 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -40,6 +40,10 @@
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetUUIDString"/>
     </property>
+    <method name="AbortJob">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainAbortJob"/>
+    </method>
     <method name="AttachDevice">
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainAttachDeviceFlags"/>
diff --git a/src/domain.c b/src/domain.c
index e80749b..d1be665 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -302,6 +302,26 @@ virtDBusDomainSetAutostart(GVariant *value,
         return virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusDomainAbortJob(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(virDomain) domain = NULL;
+
+    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+    if (!domain)
+        return;
+
+    if (virDomainAbortJob(domain) < 0)
+        virtDBusUtilSetLastVirtError(error);
+}
+
 static void
 virtDBusDomainAttachDevice(GVariant *inArgs,
                            GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -703,6 +723,7 @@ static virtDBusGDBusPropertyTable virtDBusDomainPropertyTable[] = {
 };
 
 static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
+    { "AbortJob", virtDBusDomainAbortJob },
     { "AttachDevice", virtDBusDomainAttachDevice },
     { "Create", virtDBusDomainCreate },
     { "Destroy", virtDBusDomainDestroy },
-- 
2.15.0




More information about the libvir-list mailing list