VIR_STORAGE_POOL_EVENT_DELETED event was added in 3.1.
Test should be fixed later on to use signal handler.
Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.StoragePool.xml | 5 +++++
src/storagepool.c | 25 +++++++++++++++++++++++++
tests/test_storage.py | 7 +++++++
3 files changed, 37 insertions(+)
diff --git a/data/org.libvirt.StoragePool.xml b/data/org.libvirt.StoragePool.xml
index 7e837c0..fb21e59 100644
--- a/data/org.libvirt.StoragePool.xml
+++ b/data/org.libvirt.StoragePool.xml
@@ -13,6 +13,11 @@
value="See
https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolCreat...
<arg name="flags" type="u" direction="in"/>
</method>
+ <method name="Delete">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolDelet...
+ <arg name="flags" type="u" direction="in"/>
+ </method>
<method name="Destroy">
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolDestr...
diff --git a/src/storagepool.c b/src/storagepool.c
index d4cd7a7..bf1fd3f 100644
--- a/src/storagepool.c
+++ b/src/storagepool.c
@@ -72,6 +72,30 @@ virtDBusStoragePoolCreate(GVariant *inArgs,
virtDBusUtilSetLastVirtError(error);
}
+static void
+virtDBusStoragePoolDelete(GVariant *inArgs,
+ GUnixFDList *inFDs G_GNUC_UNUSED,
+ const gchar *objectPath,
+ gpointer userData,
+ GVariant **outArgs G_GNUC_UNUSED,
+ GUnixFDList **outFDs G_GNUC_UNUSED,
+ GError **error)
+{
+ virtDBusConnect *connect = userData;
+ g_autoptr(virStoragePool) storagePool = NULL;
+ guint flags;
+
+ g_variant_get(inArgs, "(u)", &flags);
+
+ storagePool = virtDBusStoragePoolGetVirStoragePool(connect, objectPath,
+ error);
+ if (!storagePool)
+ return;
+
+ if (virStoragePoolDelete(storagePool, flags) < 0)
+ virtDBusUtilSetLastVirtError(error);
+}
+
static void
virtDBusStoragePoolDestroy(GVariant *inArgs G_GNUC_UNUSED,
GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -100,6 +124,7 @@ static virtDBusGDBusPropertyTable virtDBusStoragePoolPropertyTable[] =
{
static virtDBusGDBusMethodTable virtDBusStoragePoolMethodTable[] = {
{ "Build", virtDBusStoragePoolBuild },
{ "Create", virtDBusStoragePoolCreate },
+ { "Delete", virtDBusStoragePoolDelete },
{ "Destroy", virtDBusStoragePoolDestroy },
{ 0 }
};
diff --git a/tests/test_storage.py b/tests/test_storage.py
index b1927cb..c4c7cf1 100755
--- a/tests/test_storage.py
+++ b/tests/test_storage.py
@@ -28,6 +28,13 @@ class TestStoragePool(libvirttest.BaseTestClass):
self.main_loop()
+ def test_storage_pool_delete(self):
+ _, test_storage_pool = self.test_storage_pool()
+ interface_obj = dbus.Interface(test_storage_pool,
+ 'org.libvirt.StoragePool')
+ interface_obj.Destroy()
+ interface_obj.Delete(0)
+
def test_storage_pool_destroy(self):
def storage_pool_destroyed(path, event, _detail):
if event != libvirttest.StoragePoolEvent.STOPPED:
--
2.15.0