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

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



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


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