Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Domain.xml | 6 ++++++
src/events.c | 27 +++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index bcd0779..61654a6 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -578,6 +578,12 @@
<arg name="xml" type="s" direction="in"/>
<arg name="flags" type="u" direction="in"/>
</method>
+ <signal name="AgentLifecycle">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEven...
+ <arg name="state" type="i"/>
+ <arg name="reason" type="i"/>
+ </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 5880b1b..350d084 100644
--- a/src/events.c
+++ b/src/events.c
@@ -5,6 +5,29 @@
#include <libvirt/libvirt.h>
+static gint
+virtDBusEventsDomainAgentLifecycle(virConnectPtr connection G_GNUC_UNUSED,
+ virDomainPtr domain,
+ gint state,
+ 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,
+ "AgentLifecycle",
+ g_variant_new("(ii)", state, reason),
+ NULL);
+
+ return 0;
+}
+
static gint
virtDBusEventsDomainLifecycle(virConnectPtr connection G_GNUC_UNUSED,
virDomainPtr domain,
@@ -276,6 +299,10 @@ virtDBusEventsRegisterStoragePoolEvent(virtDBusConnect *connect,
void
virtDBusEventsRegister(virtDBusConnect *connect)
{
+ virtDBusEventsRegisterDomainEvent(connect,
+ VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE,
+
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainAgentLifecycle));
+
virtDBusEventsRegisterDomainEvent(connect,
VIR_DOMAIN_EVENT_ID_LIFECYCLE,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainLifecycle));
--
2.15.0