Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Domain.xml | 4 ++++
src/events.c | 25 +++++++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index a9a6f5c..13f9ee3 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -639,6 +639,10 @@
<arg name="authScheme" type="s"/>
<arg name="identities" type="a(ss)"/>
</signal>
+ <signal name="Reboot">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEven...
+ </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 f927b26..d409c50 100644
--- a/src/events.c
+++ b/src/events.c
@@ -240,6 +240,27 @@ virtDBusEventsDomainGraphics(virConnectPtr connection G_GNUC_UNUSED,
return 0;
}
+static gint
+virtDBusEventsDomainReboot(virConnectPtr connection G_GNUC_UNUSED,
+ virDomainPtr domain,
+ 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,
+ "Reboot",
+ NULL,
+ NULL);
+
+ return 0;
+}
+
static gint
virtDBusEventsDomainTrayChange(virConnectPtr connection G_GNUC_UNUSED,
virDomainPtr domain,
@@ -488,6 +509,10 @@ virtDBusEventsRegister(virtDBusConnect *connect)
VIR_DOMAIN_EVENT_ID_GRAPHICS,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainGraphics));
+ virtDBusEventsRegisterDomainEvent(connect,
+ VIR_DOMAIN_EVENT_ID_REBOOT,
+
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainReboot));
+
virtDBusEventsRegisterDomainEvent(connect,
VIR_DOMAIN_EVENT_ID_TRAY_CHANGE,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainTrayChange));
--
2.15.0