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 61654a6..c119173 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -584,6 +584,11 @@
<arg name="state" type="i"/>
<arg name="reason" type="i"/>
</signal>
+ <signal name="BalloonChange">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEven...
+ <arg name="actual" type="t"/>
+ </signal>
<signal name="DeviceAdded">
<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 350d084..3f1a4ab 100644
--- a/src/events.c
+++ b/src/events.c
@@ -28,6 +28,28 @@ virtDBusEventsDomainAgentLifecycle(virConnectPtr connection
G_GNUC_UNUSED,
return 0;
}
+static gint
+virtDBusEventsDomainBalloonChange(virConnectPtr connection G_GNUC_UNUSED,
+ virDomainPtr domain,
+ guint64 actual,
+ 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,
+ "BalloonChange",
+ g_variant_new("(t)", actual),
+ NULL);
+
+ return 0;
+}
+
static gint
virtDBusEventsDomainLifecycle(virConnectPtr connection G_GNUC_UNUSED,
virDomainPtr domain,
@@ -303,6 +325,10 @@ virtDBusEventsRegister(virtDBusConnect *connect)
VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainAgentLifecycle));
+ virtDBusEventsRegisterDomainEvent(connect,
+ VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE,
+
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainBalloonChange));
+
virtDBusEventsRegisterDomainEvent(connect,
VIR_DOMAIN_EVENT_ID_LIFECYCLE,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainLifecycle));
--
2.15.0