From nobody Fri Dec 19 09:43:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525973192367806.2066576157641; Thu, 10 May 2018 10:26:32 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C9634C05166B; Thu, 10 May 2018 17:26:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7AF465E7CC; Thu, 10 May 2018 17:26:30 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 264B64BB78; Thu, 10 May 2018 17:26:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4AHQJ1V020530 for ; Thu, 10 May 2018 13:26:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 159502166BB2; Thu, 10 May 2018 17:26:19 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id ADA552166BAD for ; Thu, 10 May 2018 17:26:18 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 10 May 2018 19:25:55 +0200 Message-Id: <20180510172614.11687-4-kkoukiou@redhat.com> In-Reply-To: <20180510172614.11687-1-kkoukiou@redhat.com> References: <20180510172614.11687-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 03/22] events: Register VIR_STORAGE_POOL_EVENT_ID_REFRESH X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 10 May 2018 17:26:31 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.StoragePool.xml | 4 ++++ src/events.c | 27 +++++++++++++++++++++++++++ tests/test_storage.py | 10 ++++++++++ 3 files changed, 41 insertions(+) diff --git a/data/org.libvirt.StoragePool.xml b/data/org.libvirt.StoragePoo= l.xml index f33ed38..01ab39d 100644 --- a/data/org.libvirt.StoragePool.xml +++ b/data/org.libvirt.StoragePool.xml @@ -66,5 +66,9 @@ + + + diff --git a/src/events.c b/src/events.c index 53cd725..5880b1b 100644 --- a/src/events.c +++ b/src/events.c @@ -1,6 +1,7 @@ #include "domain.h" #include "events.h" #include "util.h" +#include "storagepool.h" =20 #include =20 @@ -190,6 +191,28 @@ virtDBusEventsStoragePoolLifecycle(virConnectPtr conne= ction G_GNUC_UNUSED, return 0; } =20 +static gint +virtDBusEventsStoragePoolRefresh(virConnectPtr connection G_GNUC_UNUSED, + virStoragePoolPtr storagePool, + gpointer opaque) +{ + virtDBusConnect *connect =3D opaque; + g_autofree gchar *path =3D NULL; + + path =3D 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_LIFEC= YCLE, VIR_STORAGE_POOL_EVENT_CALLBACK= (virtDBusEventsStoragePoolLifecycle)); + + virtDBusEventsRegisterStoragePoolEvent(connect, + VIR_STORAGE_POOL_EVENT_ID_REFRE= SH, + VIR_STORAGE_POOL_EVENT_CALLBACK= (virtDBusEventsStoragePoolRefresh)); } diff --git a/tests/test_storage.py b/tests/test_storage.py index d1d393f..b9e7090 100755 --- a/tests/test_storage.py +++ b/tests/test_storage.py @@ -108,6 +108,16 @@ class TestStoragePool(libvirttest.BaseTestClass): =20 self.main_loop() =20 + def test_storage_pool_refresh(self): + _, test_storage_pool =3D self.test_storage_pool() + interface_obj =3D 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() + =20 if __name__ =3D=3D '__main__': libvirttest.run() --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list