提交 9f0e9cba 编写于 作者: C Cole Robinson

storage: lvm: lvcreate fails with allocation=0, don't do that

On F17 at least, this command fails:

$ sudo /usr/sbin/lvcreate --name sparsetest -L 0K --virtualsize 16384K vgvirt
  Unable to create new logical volume with no extents

Which is unfortunate since allocation=0 is what virt-manager tries to use
by default.

Rather than telling the user 'don't do that', let's just give them the
smallest allocation possible if alloc=0 is requested.

https://bugzilla.redhat.com/show_bug.cgi?id=866481
上级 01df6f2b
......@@ -725,7 +725,8 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
NULL);
virCommandAddArg(cmd, "-L");
if (vol->capacity != vol->allocation) {
virCommandAddArgFormat(cmd, "%lluK", VIR_DIV_UP(vol->allocation, 1024));
virCommandAddArgFormat(cmd, "%lluK",
VIR_DIV_UP(vol->allocation ? vol->allocation : 1, 1024));
virCommandAddArg(cmd, "--virtualsize");
}
virCommandAddArgFormat(cmd, "%lluK", VIR_DIV_UP(vol->capacity, 1024));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册