提交 b04d1b6a 编写于 作者: J John Ferlan

storage: Add --shrink to qemu-img command when shrinking vol

https://bugzilla.redhat.com/show_bug.cgi?id=1613746

When shrinking the capacity of a qcow2 or luks volume using
the qemu-img program, the --shrink qualifier must be added.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 b4833917
......@@ -2294,12 +2294,12 @@ storageBackendResizeQemuImg(virStoragePoolObjPtr pool,
* a multiple of 512 */
capacity = VIR_ROUND_UP(capacity, 512);
cmd = virCommandNew(img_tool);
cmd = virCommandNewArgList(img_tool, "resize", NULL);
if (capacity < vol->target.capacity)
virCommandAddArg(cmd, "--shrink");
if (!vol->target.encryption) {
virCommandAddArgList(cmd, "resize", vol->target.path, NULL);
virCommandAddArg(cmd, vol->target.path);
} else {
virCommandAddArg(cmd, "resize");
if (storageBackendCreateQemuImgSecretObject(cmd, secretPath,
secretAlias) < 0)
goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册