Re: [PATCH 3/7] storage:dir: .deleteVol callback for ploop volume

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 05.02.2016 19:23, Olga Krishtal wrote:
Deletes whole directory of a ploop volume. To delete ploop image it has
to be unmounted.

Signed-off-by: Olga Krishtal <okrishtal@xxxxxxxxxxxxx>
---
  src/storage/storage_backend.c    | 6 ++++++
  src/storage/storage_backend.h    | 2 ++
  src/storage/storage_backend_fs.c | 5 ++++-
  3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 96bd3fc..1b4ffbc 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -861,6 +861,12 @@ int virStorageBackendCreatePloop(virConnectPtr conn ATTRIBUTE_UNUSED,
      return ret;
  }
+int virStorageBackendDeletePloop(virConnectPtr conn ATTRIBUTE_UNUSED,
+                           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..7d354c5 100644
--- a/src/storage/storage_backend.h
+++ b/src/storage/storage_backend.h
@@ -115,6 +115,8 @@ int virStorageBackendCreatePloop(virConnectPtr conn,
                                   virStorageVolDefPtr inputvol,
                                   unsigned int flags);
+int virStorageBackendDeletePloop(virConnectPtr conn,
+                                 virStorageVolDefPtr vol);
virStorageBackendBuildVolFrom
  virStorageBackendGetBuildVolFromFunction(virStorageVolDefPtr vol,
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 3487545..9926a6e 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -1247,7 +1247,6 @@ virStorageBackendFileSystemVolDelete(virConnectPtr conn ATTRIBUTE_UNUSED,
      switch ((virStorageVolType) vol->type) {
      case VIR_STORAGE_VOL_FILE:
      case VIR_STORAGE_VOL_DIR:
-    case VIR_STORAGE_VOL_PLOOP:
          if (virFileRemove(vol->target.path, vol->target.perms->uid,
                            vol->target.perms->gid) < 0) {
              /* Silently ignore failures where the vol has already gone away */
@@ -1264,6 +1263,10 @@ virStorageBackendFileSystemVolDelete(virConnectPtr conn ATTRIBUTE_UNUSED,
              }
          }
          break;
+    case VIR_STORAGE_VOL_PLOOP:
+        if (virStorageBackendDeletePloop(conn, vol) != 0)
check ret code like < 0
+            return -1;
+        break;
      case VIR_STORAGE_VOL_BLOCK:
      case VIR_STORAGE_VOL_NETWORK:
      case VIR_STORAGE_VOL_NETDIR:

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]