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 f693198..205d035 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -679,6 +679,11 @@
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEven...
<arg name="reason" type="i"/>
</signal>
+ <signal name="PMSuspendDisk">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEven...
+ <arg name="reason" type="i"/>
+ </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 818aae4..26b1947 100644
--- a/src/events.c
+++ b/src/events.c
@@ -384,6 +384,28 @@ virtDBusEventsDomainPMSuspend(virConnectPtr connection
G_GNUC_UNUSED,
return 0;
}
+static gint
+virtDBusEventsDomainPMSuspendDisk(virConnectPtr connection G_GNUC_UNUSED,
+ virDomainPtr domain,
+ gint 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,
+ "PMSuspendDisk",
+ g_variant_new("(i)", reason),
+ NULL);
+
+ return 0;
+}
+
static gint
virtDBusEventsDomainReboot(virConnectPtr connection G_GNUC_UNUSED,
virDomainPtr domain,
@@ -677,6 +699,10 @@ virtDBusEventsRegister(virtDBusConnect *connect)
VIR_DOMAIN_EVENT_ID_PMSUSPEND,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainPMSuspend));
+ virtDBusEventsRegisterDomainEvent(connect,
+ VIR_DOMAIN_EVENT_ID_PMSUSPEND_DISK,
+
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainPMSuspendDisk));
+
virtDBusEventsRegisterDomainEvent(connect,
VIR_DOMAIN_EVENT_ID_REBOOT,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainReboot));
--
2.15.0