storage: allow zero capacity with non-backing file to be created

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>
This commit is contained in:
Chris J Arges 2015-06-30 15:19:03 -05:00 committed by John Ferlan
parent 136f17efd1
commit c6eea54008

View File

@ -1075,7 +1075,7 @@ virStorageBackendCreateQemuImgCmdFromVol(virConnectPtr conn,
if (info.inputPath) if (info.inputPath)
virCommandAddArg(cmd, info.inputPath); virCommandAddArg(cmd, info.inputPath);
virCommandAddArg(cmd, info.path); virCommandAddArg(cmd, info.path);
if (!info.inputPath && info.size_arg) if (!info.inputPath && (info.size_arg || !info.backingPath))
virCommandAddArgFormat(cmd, "%lluK", info.size_arg); virCommandAddArgFormat(cmd, "%lluK", info.size_arg);
return cmd; return cmd;