Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
Return empty string when variable is NULL
data/org.libvirt.Domain.xml | 8 ++++++++
src/events.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 824ab82..a0b39b0 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -657,6 +657,14 @@
<arg name="authScheme" type="s"/>
<arg name="identities" type="a(ss)"/>
</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="JobCompleted">
<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 f206d8a..06c5832 100644
--- a/src/events.c
+++ b/src/events.c
@@ -240,6 +240,33 @@ virtDBusEventsDomainGraphics(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,
+ VIRT_DBUS_EMPTY_STR(device),
+ action, reason),
+ NULL);
+
+ return 0;
+}
+
static gint
virtDBusEventsDomainJobCompleted(virConnectPtr connection G_GNUC_UNUSED,
virDomainPtr domain,
@@ -712,6 +739,10 @@ virtDBusEventsRegister(virtDBusConnect *connect)
VIR_DOMAIN_EVENT_ID_GRAPHICS,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainGraphics));
+ virtDBusEventsRegisterDomainEvent(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));
--
2.15.0