On 05/26/2015 02:58 PM, Erik Skultety wrote:
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;
+ }
The problem does not reside in the error itself (because other backends
do check for this in
virStorageBackendCreateRaw|virStorageBackendBlockFrom), rather in the
way we delete volumes in RBD backend. So NACK for this, I'll post a v2.
+ 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;
Erik