Commit 05a45293 authored by Katerina Koukiou's avatar Katerina Koukiou

Implement Delete method for StorageVol Interface

Signed-off-by: 's avatarKaterina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Jano Tomko's avatarJán Tomko <jtomko@redhat.com>
parent fea2ad61
......@@ -18,6 +18,11 @@
value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetPath"/>
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
</property>
<method name="Delete">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolDelete"/>
<arg name="flags" type="u" direction="in"/>
</method>
<method name="GetInfo">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetInfoFlags"/>
......
......@@ -90,6 +90,30 @@ virtDBusStorageVolGetPath(const gchar *objectPath,
*value = g_variant_new("s", path);
}
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)", &flags);
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 },
......
......@@ -133,6 +133,12 @@ class TestStoragePool(libvirttest.BaseTestClass):
@pytest.mark.usefixtures('storage_volume_create')
class TestStorageVolume(libvirttest.BaseTestClass):
def test_storage_vol_delete(self):
test_storage_vol_path, test_storage_vol = self.get_test_storage_volume()
interface_obj = dbus.Interface(test_storage_vol,
'org.libvirt.StorageVol')
interface_obj.Delete(0)
def test_storage_vol_properties_type(self):
_, obj = self.get_test_storage_volume()
......
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