qcow2: Use BB for resizing in qcow2_amend_options()
In order to able to convert bdrv_truncate() to take a BdrvChild and
later to correctly check the resize permission here, we need to use a
BlockBackend for resizing the image.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
diff --git a/block/qcow2.c b/block/qcow2.c
index 3e274bd..254545a 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -3250,7 +3250,11 @@
}
if (new_size) {
- ret = bdrv_truncate(bs, new_size);
+ BlockBackend *blk = blk_new();
+ blk_insert_bs(blk, bs);
+ ret = blk_truncate(blk, new_size);
+ blk_unref(blk);
+
if (ret < 0) {
return ret;
}