Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Domain.xml | 7 +++++++
src/events.c | 28 ++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index c119173..781ca03 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -589,6 +589,13 @@
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEven...
<arg name="actual" type="t"/>
</signal>
+ <signal name="BlockJob">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEven...
+ <arg name="disk" type="s"/>
+ <arg name="type" type="i"/>
+ <arg name="status" type="i"/>
+ </signal>
<signal name="DeviceAdded">
<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 3f1a4ab..d89756c 100644
--- a/src/events.c
+++ b/src/events.c
@@ -50,6 +50,30 @@ virtDBusEventsDomainBalloonChange(virConnectPtr connection
G_GNUC_UNUSED,
return 0;
}
+static gint
+virtDBusEventsDomainBlockJob(virConnectPtr connection G_GNUC_UNUSED,
+ virDomainPtr domain,
+ gchar *disk,
+ gint type,
+ gint status,
+ gpointer opaque)
+{
+ virtDBusConnect *connect = opaque;
+ g_autofree gchar *path = NULL;
+
+ path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);
+
+ g_dbus_connection_emit_signal(connect->bus,
+ NULL,
+ path,
+ VIRT_DBUS_DOMAIN_INTERFACE,
+ "BlockJob",
+ g_variant_new("(sii)", disk, type, status),
+ NULL);
+
+ return 0;
+}
+
static gint
virtDBusEventsDomainLifecycle(virConnectPtr connection G_GNUC_UNUSED,
virDomainPtr domain,
@@ -329,6 +353,10 @@ virtDBusEventsRegister(virtDBusConnect *connect)
VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainBalloonChange));
+ virtDBusEventsRegisterDomainEvent(connect,
+ VIR_DOMAIN_EVENT_ID_BLOCK_JOB,
+
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainBlockJob));
+
virtDBusEventsRegisterDomainEvent(connect,
VIR_DOMAIN_EVENT_ID_LIFECYCLE,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainLifecycle));
--
2.15.0