[PATCH 2/3] storage: wipe: Don't attempt to wipe remote storage

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

 



Volume wiping uses external tool to wipe the storage. This will not work
with purely remote storage as native gluster or RBD. Add a check to
report better error when wiping a remote volume.

Before:
 $ virsh vol-wipe --pool glusterpool qcow3
 error: Failed to wipe vol qcow3
 error: Failed to open storage volume with path 'gluster://gluster-node-1/gv0/qcow3': No such file or directory

After:
 $ virsh vol-wipe --pool glusterpool qcow3
 error: Failed to wipe vol qcow3
 error: Operation not supported: Volume wiping is not supported on non-local storage
---
 src/storage/storage_driver.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index ae86c69..7303dbf 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -2226,6 +2226,12 @@ storageVolWipeInternal(virStorageVolDefPtr def,
     VIR_DEBUG("Wiping volume with path '%s' and algorithm %u",
               def->target.path, algorithm);

+    if (!virStorageVolIsLocalStorage(def)) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("Volume wiping is not supported on non-local storage"));
+        goto cleanup;
+    }
+
     fd = open(def->target.path, O_RDWR);
     if (fd == -1) {
         virReportSystemError(errno,
-- 
2.0.0

--
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]