Re: [libvirt] [dbus PATCH 14/15] Implement Delete method for StorageVol Interface

2018-06-14 Thread Ján Tomko

On Tue, Jun 12, 2018 at 11:00:27AM +0200, Katerina Koukiou wrote:

Signed-off-by: Katerina Koukiou 
---
data/org.libvirt.StorageVol.xml |  5 +
src/storagevol.c| 25 +
tests/test_storage.py   |  6 ++
3 files changed, 36 insertions(+)



Reviewed-by: Ján Tomko 

Jano


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [dbus PATCH 14/15] Implement Delete method for StorageVol Interface

2018-06-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.StorageVol.xml |  5 +
 src/storagevol.c| 25 +
 tests/test_storage.py   |  6 ++
 3 files changed, 36 insertions(+)

diff --git a/data/org.libvirt.StorageVol.xml b/data/org.libvirt.StorageVol.xml
index 8a4eab2..7ad9459 100644
--- a/data/org.libvirt.StorageVol.xml
+++ b/data/org.libvirt.StorageVol.xml
@@ -18,6 +18,11 @@
   value="See 
https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetPath"/>
   
 
+
+  https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolDelete"/>
+  
+
 
   https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetInfoFlags"/>
diff --git a/src/storagevol.c b/src/storagevol.c
index dc05dc4..c574be9 100644
--- a/src/storagevol.c
+++ b/src/storagevol.c
@@ -90,6 +90,30 @@ virtDBusStorageVolGetPath(const gchar *objectPath,
 *value = g_variant_new("s", key);
 }
 
+static void
+virtDBusStorageVolDelete(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(virStorageVol) storageVol = NULL;
+guint flags;
+
+g_variant_get(inArgs, "(u)", );
+
+storageVol = virtDBusStorageVolGetVirStorageVol(connect, objectPath,
+error);
+if (!storageVol)
+return;
+
+if (virStorageVolDelete(storageVol, flags) < 0)
+virtDBusUtilSetLastVirtError(error);
+}
+
 static void
 virtDBusStorageVolGetInfo(GVariant *inArgs,
   GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -204,6 +228,7 @@ static virtDBusGDBusPropertyTable 
virtDBusStorageVolPropertyTable[] = {
 };
 
 static virtDBusGDBusMethodTable virtDBusStorageVolMethodTable[] = {
+{ "Delete", virtDBusStorageVolDelete },
 { "GetInfo", virtDBusStorageVolGetInfo },
 { "GetXMLDesc", virtDBusStorageVolGetXMLDesc },
 { "Resize", virtDBusStorageVolResize },
diff --git a/tests/test_storage.py b/tests/test_storage.py
index 1d0afe0..f342e77 100755
--- a/tests/test_storage.py
+++ b/tests/test_storage.py
@@ -132,6 +132,12 @@ class TestStoragePool(libvirttest.BaseTestClass):
 
 
 class TestStorageVolume(libvirttest.BaseTestClass):
+def test_storage_vol_delete(self):
+test_storage_vol_path, test_storage_vol = self.test_storage_vol()
+interface_obj = dbus.Interface(test_storage_vol,
+   'org.libvirt.StorageVol')
+interface_obj.Delete(0)
+
 def test_storage_vol_properties_type(self):
 _, obj = self.test_storage_vol()
 
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list