Commit 70b27f36 authored by Kevin Wolf's avatar Kevin Wolf
Browse files

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: default avatarKevin Wolf <kwolf@redhat.com>
Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
parent 7dad9ee6
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -3250,7 +3250,11 @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
    }

    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;
        }