[PATCH 2/2] storage: Forbid wiping formatted volume types that are not supported

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

 



Until now we allowed that to happen, however the only thing we supported
was either rewiting the file or truncating it.  That however doesn't
keep the format of that file, so QCOWs, VDIs and all others just became
RAW with arbitrary size.  Not to mention any domain using such volume
could not start anymore.  Instead of dealing with the recreation of
every single possible file that we have (and possibly failing due to
create_tool capabilities) just forbid it for now.  We even state in our
documentation that it has no value for file-backed volumes.

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

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/storage/storage_backend.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index eff6a2f581a1..600539967430 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -2353,6 +2353,16 @@ virStorageBackendVolWipeLocal(virConnectPtr conn ATTRIBUTE_UNUSED,

     VIR_DEBUG("Wiping volume with path '%s'", vol->target.path);

+    if (vol->type == VIR_STORAGE_VOL_FILE &&
+        vol->target.format != VIR_STORAGE_FILE_PLOOP &&
+        vol->target.format != VIR_STORAGE_FILE_RAW) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
+                       _("Wiping file volume with format '%s' is unsupported, "
+                         "consider deleting and re-creating the volume"),
+                       virStorageFileFormatTypeToString(vol->target.format));
+        return -1;
+    }
+
     if (vol->target.format == VIR_STORAGE_FILE_PLOOP)
         ret = virStorageBackendVolWipePloop(vol);
     else
-- 
2.9.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]