Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Domain.xml | 5 +++++
src/events.c | 26 ++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 39b7ac6..e2e99a9 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -705,5 +705,10 @@
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEven...
<arg name="params" type="a{sv}"/>
</signal>
+ <signal name="Watchdog">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEven...
+ <arg name="action" type="i"/>
+ </signal>
</interface>
</node>
diff --git a/src/events.c b/src/events.c
index d8c2a37..2697d82 100644
--- a/src/events.c
+++ b/src/events.c
@@ -520,6 +520,28 @@ virtDBusEventsDomainTunable(virConnectPtr connection G_GNUC_UNUSED,
return 0;
}
+static gint
+virtDBusEventsDomainWatchdog(virConnectPtr connection G_GNUC_UNUSED,
+ virDomainPtr domain,
+ gint action,
+ 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,
+ "Watchdog",
+ g_variant_new("(i)", action),
+ NULL);
+
+ return 0;
+}
+
static gint
virtDBusEventsDomainDiskChange(virConnectPtr connection G_GNUC_UNUSED,
virDomainPtr domain,
@@ -793,6 +815,10 @@ virtDBusEventsRegister(virtDBusConnect *connect)
VIR_DOMAIN_EVENT_ID_TUNABLE,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainTunable));
+ virtDBusEventsRegisterDomainEvent(connect,
+ VIR_DOMAIN_EVENT_ID_WATCHDOG,
+
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainWatchdog));
+
virtDBusEventsRegisterNetworkEvent(connect,
VIR_NETWORK_EVENT_ID_LIFECYCLE,
VIR_NETWORK_EVENT_CALLBACK(virtDBusEventsNetworkLifecycle));
--
2.15.0