Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Domain.xml | 5 +++++
src/events.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 0cc0080..76f9a97 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -658,6 +658,11 @@
<arg name="action" type="i"/>
<arg name="reason" type="s"/>
</signal>
+ <signal name="JobCompleted">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEven...
+ <arg name="params" type="a{sv}"/>
+ </signal>
<signal name="TrayChange">
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEven...
diff --git a/src/events.c b/src/events.c
index 433dba3..5943ea5 100644
--- a/src/events.c
+++ b/src/events.c
@@ -291,6 +291,32 @@ virtDBusEventsDomainIOErrorReason(virConnectPtr connection
G_GNUC_UNUSED,
return 0;
}
+static gint
+virtDBusEventsDomainJobCompleted(virConnectPtr connection G_GNUC_UNUSED,
+ virDomainPtr domain,
+ virTypedParameterPtr params,
+ gint nparams,
+ gpointer opaque)
+{
+ virtDBusConnect *connect = opaque;
+ g_autofree gchar *path = NULL;
+ GVariant *gargs;
+
+ path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);
+
+ gargs = virtDBusUtilTypedParamsToGVariant(params, nparams);
+
+ g_dbus_connection_emit_signal(connect->bus,
+ NULL,
+ path,
+ VIRT_DBUS_DOMAIN_INTERFACE,
+ "JobCompleted",
+ g_variant_new_tuple(&gargs, 1),
+ NULL);
+
+ return 0;
+}
+
static gint
virtDBusEventsDomainReboot(virConnectPtr connection G_GNUC_UNUSED,
virDomainPtr domain,
@@ -568,6 +594,10 @@ virtDBusEventsRegister(virtDBusConnect *connect)
VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainIOErrorReason));
+ virtDBusEventsRegisterDomainEvent(connect,
+ VIR_DOMAIN_EVENT_ID_JOB_COMPLETED,
+
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainJobCompleted));
+
virtDBusEventsRegisterDomainEvent(connect,
VIR_DOMAIN_EVENT_ID_REBOOT,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainReboot));
--
2.15.0