[PATCH] storage: Report error when using metadata prealloc with non-qcow2 volumes

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

 



We already report error from backend (virStorageBackendCreateRaw,
virStorageBackendCreateBlockFrom), but we should also report the same
error (applies to raw formated volumes and block type volumes as
well) when creating a volume from a XML, not only from an existing
volume.
---
 src/storage/storage_driver.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index ac4a74a..b519011 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1803,6 +1803,22 @@ storageVolCreateXML(virStoragePoolPtr obj,
         goto cleanup;
     }
 
+    if (flags & VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA) {
+        if (voldef->target.format == VIR_STORAGE_FILE_RAW) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           "%s", _("metadata preallocation is not supported for "
+                                   "raw volumes"));
+            goto cleanup;
+        }
+
+        if (voldef->type == VIR_STORAGE_VOL_BLOCK) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           "%s", _("metadata preallocation is not supported for "
+                                   "block volumes"));
+            goto cleanup;
+        }
+    }
+
     if (virStorageVolCreateXMLEnsureACL(obj->conn, pool->def, voldef) < 0)
         goto cleanup;
 
-- 
1.9.3

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