Commit 2150dc37 authored by Katerina Koukiou's avatar Katerina Koukiou

events: Register VIR_STORAGE_POOL_EVENT_ID_REFRESH

Signed-off-by: default avatarKaterina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Pavel Hrdina's avatarPavel Hrdina <phrdina@redhat.com>
parent 471b8f46
......@@ -66,5 +66,9 @@
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolUndefine"/>
</method>
<signal name="Refresh">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virConnectStoragePoolEventGenericCallback"/>
</signal>
</interface>
</node>
#include "domain.h"
#include "events.h"
#include "util.h"
#include "storagepool.h"
#include <libvirt/libvirt.h>
......@@ -190,6 +191,28 @@ virtDBusEventsStoragePoolLifecycle(virConnectPtr connection G_GNUC_UNUSED,
return 0;
}
static gint
virtDBusEventsStoragePoolRefresh(virConnectPtr connection G_GNUC_UNUSED,
virStoragePoolPtr storagePool,
gpointer opaque)
{
virtDBusConnect *connect = opaque;
g_autofree gchar *path = NULL;
path = virtDBusUtilBusPathForVirStoragePool(storagePool,
connect->storagePoolPath);
g_dbus_connection_emit_signal(connect->bus,
NULL,
path,
VIRT_DBUS_STORAGEPOOL_INTERFACE,
"Refresh",
NULL,
NULL);
return 0;
}
static void
virtDBusEventsRegisterDomainEvent(virtDBusConnect *connect,
gint id,
......@@ -284,4 +307,8 @@ virtDBusEventsRegister(virtDBusConnect *connect)
virtDBusEventsRegisterStoragePoolEvent(connect,
VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE,
VIR_STORAGE_POOL_EVENT_CALLBACK(virtDBusEventsStoragePoolLifecycle));
virtDBusEventsRegisterStoragePoolEvent(connect,
VIR_STORAGE_POOL_EVENT_ID_REFRESH,
VIR_STORAGE_POOL_EVENT_CALLBACK(virtDBusEventsStoragePoolRefresh));
}
......@@ -108,6 +108,16 @@ class TestStoragePool(libvirttest.BaseTestClass):
self.main_loop()
def test_storage_pool_refresh(self):
_, test_storage_pool = self.test_storage_pool()
interface_obj = dbus.Interface(test_storage_pool,
'org.libvirt.StoragePool')
interface_obj.connect_to_signal('Refresh',
lambda: self.loop.quit())
interface_obj.Refresh(0)
self.main_loop()
if __name__ == '__main__':
libvirttest.run()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment