[libvirt] [PATCH 1/2] storage: allow zero capacity with non-backing file to be created

Chris J Arges chris.j.arges at canonical.com
Tue Jun 30 20:19:03 UTC 2015


In commit fbcf7da95, a change was introduced that no longer allowed defining
volumes via XML with a capacity of '0'. Because we check for info.size_arg to be
non-zero, this use-case fails. This patch allows info.size_arg to be zero if no
backing store is specified.

Signed-off-by: Chris J Arges <chris.j.arges at canonical.com>
---
 src/storage/storage_backend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index ce59f63..c661662 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -1068,7 +1068,7 @@ virStorageBackendCreateQemuImgCmdFromVol(virConnectPtr conn,
     if (info.inputPath)
         virCommandAddArg(cmd, info.inputPath);
     virCommandAddArg(cmd, info.path);
-    if (!info.inputPath && info.size_arg)
+    if (!info.inputPath && (info.size_arg || !info.backingPath))
         virCommandAddArgFormat(cmd, "%lluK", info.size_arg);
 
     return cmd;
-- 
1.9.1




More information about the libvir-list mailing list