[libvirt] [PATCH 09/12] storage_util: Split preallocate set in storageBackendCreateQemuImgOpts

John Ferlan jferlan at redhat.com
Tue May 8 12:48:02 UTC 2018


The only way preallocate could be set is if the info->format was
not RAW (see storageBackendCreateQemuImgSetBacking), so let's just
extract it from the if/else surrounding the application of the
encryption options.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/storage/storage_util.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index cedec10403..bd8fb7ca92 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -831,12 +831,13 @@ storageBackendCreateQemuImgOpts(virStorageEncryptionInfoDefPtr enc,
     } else {
         if (info.encryption)
             virBufferAddLit(&buf, "encryption=on,");
-        if (info.preallocate) {
-            if (info.size_arg > info.allocation)
-                virBufferAddLit(&buf, "preallocation=metadata,");
-            else
-                virBufferAddLit(&buf, "preallocation=falloc,");
-        }
+    }
+
+    if (info.preallocate) {
+        if (info.size_arg > info.allocation)
+            virBufferAddLit(&buf, "preallocation=metadata,");
+        else
+            virBufferAddLit(&buf, "preallocation=falloc,");
     }
 
     if (info.nocow)
-- 
2.14.3




More information about the libvir-list mailing list