]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
storage: allow zero capacity with non-backing file to be created
authorChris J Arges <chris.j.arges@canonical.com>
Tue, 30 Jun 2015 20:19:03 +0000 (15:19 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 24 Jul 2015 15:22:20 +0000 (11:22 -0400)
In commit 155ca616e, 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@canonical.com>
src/storage/storage_backend.c

index 2b7cf5a7195b16854fc463acf7a53f018e23dfd8..db4973960af6922c05f1b26e072dd996b3435d85 100644 (file)
@@ -1075,7 +1075,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;