Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
Use only v2 of BlockJob
data/org.libvirt.Domain.xml | 8 ++++++++
src/events.c | 28 ++++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index b6e49d6..f5e49b0 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -613,6 +613,14 @@
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...
+ Callback was registered using
VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2"/>
+ <arg name="disk" type="s"/>
+ <arg name="type" type="i"/>
+ <arg name="status" type="i"/>
+ </signal>
<signal name="ControlError">
<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 206c79f..21d6d07 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
virtDBusEventsDomainControlError(virConnectPtr connection G_GNUC_UNUSED,
virDomainPtr domain,
@@ -600,6 +624,10 @@ virtDBusEventsRegister(virtDBusConnect *connect)
VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainBalloonChange));
+ virtDBusEventsRegisterDomainEvent(connect,
+ VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2,
+
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainBlockJob));
+
virtDBusEventsRegisterDomainEvent(connect,
VIR_DOMAIN_EVENT_ID_CONTROL_ERROR,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainControlError));
--
2.15.0