Deletes whole directory of a ploop volume. To delete ploop image it has
to be unmounted.
Signed-off-by: Olga Krishtal <okrishtal(a)virtuozzo.com>
---
src/storage/storage_backend.c | 5 +++++
src/storage/storage_backend.h | 1 +
src/storage/storage_backend_fs.c | 5 +++++
3 files changed, 11 insertions(+)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index d70642e..9f0e020 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -870,6 +870,11 @@ int virStorageBackendCreatePloop(virConnectPtr conn
ATTRIBUTE_UNUSED,
return ret;
}
+int virStorageBackendDeletePloop(virStorageVolDefPtr vol)
+{
+ return virFileDeleteTree(vol->target.path);
+}
+
enum {
QEMU_IMG_BACKING_FORMAT_NONE = 0,
QEMU_IMG_BACKING_FORMAT_FLAG,
diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h
index 852d6ed..3529755 100644
--- a/src/storage/storage_backend.h
+++ b/src/storage/storage_backend.h
@@ -115,6 +115,7 @@ int virStorageBackendCreatePloop(virConnectPtr conn,
virStorageVolDefPtr inputvol,
unsigned int flags);
+int virStorageBackendDeletePloop(virStorageVolDefPtr vol);
virStorageBackendBuildVolFrom
virStorageBackendGetBuildVolFromFunction(virStorageVolDefPtr vol,
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 80c7e9e..f494fd2 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -1245,6 +1245,11 @@ virStorageBackendFileSystemVolDelete(virConnectPtr conn
ATTRIBUTE_UNUSED,
switch ((virStorageVolType) vol->type) {
case VIR_STORAGE_VOL_FILE:
case VIR_STORAGE_VOL_DIR:
+ if (vol->target.format == VIR_STORAGE_FILE_PLOOP) {
+ if (virStorageBackendDeletePloop(vol) < 0)
+ return -1;
+ break;
+ }
if (virFileRemove(vol->target.path, vol->target.perms->uid,
vol->target.perms->gid) < 0) {
/* Silently ignore failures where the vol has already gone away */
--
1.8.3.1