Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Domain.xml | 8 ++++++++
src/events.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index c52f9d4..0cc0080 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -650,6 +650,14 @@
<arg name="device" type="s"/>
<arg name="action" type="i"/>
</signal>
+ <signal name="IOErrorReason">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEven...
+ <arg name="srcPath" type="s"/>
+ <arg name="device" type="s"/>
+ <arg name="action" type="i"/>
+ <arg name="reason" type="s"/>
+ </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 b7aa4e5..433dba3 100644
--- a/src/events.c
+++ b/src/events.c
@@ -265,6 +265,32 @@ virtDBusEventsDomainIOError(virConnectPtr connection G_GNUC_UNUSED,
return 0;
}
+static gint
+virtDBusEventsDomainIOErrorReason(virConnectPtr connection G_GNUC_UNUSED,
+ virDomainPtr domain,
+ const gchar *srcPath,
+ const gchar *device,
+ gint action,
+ const gchar *reason,
+ 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,
+ "IOErrorReason",
+ g_variant_new("(ssis)", srcPath, device,
+ action, reason),
+ NULL);
+
+ return 0;
+}
+
static gint
virtDBusEventsDomainReboot(virConnectPtr connection G_GNUC_UNUSED,
virDomainPtr domain,
@@ -538,6 +564,10 @@ virtDBusEventsRegister(virtDBusConnect *connect)
VIR_DOMAIN_EVENT_ID_IO_ERROR,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainIOError));
+ virtDBusEventsRegisterDomainEvent(connect,
+ VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON,
+
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainIOErrorReason));
+
virtDBusEventsRegisterDomainEvent(connect,
VIR_DOMAIN_EVENT_ID_REBOOT,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainReboot));
--
2.15.0