[PATCH] storage: Attempt to refresh volume after successful wipe volume

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

 



https://bugzilla.redhat.com/show_bug.cgi?id=1270709

When a volume wipe is successful, a volume refresh should be done afterwards
to update any volume data that may be used in future volume commands, such as
volume resize.  For a raw file volume, a wipe would truncate the file and
a followup volume resize the capacity may fail because the volume target
allocation isn't updated to reflect the wipe activity.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/storage/storage_driver.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index bbf21f6..2e59e39 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -2436,7 +2436,19 @@ storageVolWipePattern(virStorageVolPtr obj,
         goto cleanup;
     }
 
-    ret = backend->wipeVol(obj->conn, pool, vol, algorithm, flags);
+    if ((ret = backend->wipeVol(obj->conn, pool, vol, algorithm, flags)) < 0)
+        goto cleanup;
+
+    /* Best effort to refresh the volume data. If unsuccessful, we've already
+     * wiped the data so there's no going back on that. Best we can do is
+     * provide some details over what happened and move on
+     */
+    if (backend->refreshVol &&
+        backend->refreshVol(obj->conn, pool, vol) < 0) {
+        VIR_WARN("failed to refresh volume '%s' info after volume wipe",
+                 vol->name);
+        virResetLastError();
+    }
 
  cleanup:
     virStoragePoolObjUnlock(pool);
-- 
2.5.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]