Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- 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 992fb11..db5da09 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -612,6 +612,11 @@ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEventDeviceAddedCallback"/> <arg name="device" type="s"/> </signal> + <signal name="DeviceRemovalFailed"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEventDeviceRemovalFailedCallback"/> + <arg name="device" type="s"/> + </signal> <signal name="DeviceRemoved"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEventDeviceRemovedCallback"/> diff --git a/src/events.c b/src/events.c index 251ea59..b47a4a1 100644 --- a/src/events.c +++ b/src/events.c @@ -140,6 +140,28 @@ virtDBusEventsDomainDeviceAdded(virConnectPtr connection G_GNUC_UNUSED, return 0; } +static gint +virtDBusEventsDomainDeviceRemovalFailed(virConnectPtr connection G_GNUC_UNUSED, + virDomainPtr domain, + const gchar *device, + 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, + "DeviceRemovalFailed", + g_variant_new("(s)", device), + NULL); + + return 0; +} + static gint virtDBusEventsDomainDeviceRemoved(virConnectPtr connection G_GNUC_UNUSED, virDomainPtr domain, @@ -394,6 +416,10 @@ virtDBusEventsRegister(virtDBusConnect *connect) VIR_DOMAIN_EVENT_ID_DEVICE_ADDED, VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainDeviceAdded)); + virtDBusEventsRegisterDomainEvent(connect, + VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED, + VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainDeviceRemovalFailed)); + virtDBusEventsRegisterDomainEvent(connect, VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED, VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainDeviceRemoved)); -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list