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

Peter Krempa pkrempa at redhat.com
Thu Jul 10 14:30:30 UTC 2014


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




More information about the libvir-list mailing list