Skip to content

Commit

Permalink
qcow2: Use BB for resizing in qcow2_amend_options()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kevmw committed Feb 24, 2017
1 parent 7dad9ee commit 70b27f3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion block/qcow2.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit 70b27f3

Please sign in to comment.