diff options
author | Kevin Wolf <kwolf@redhat.com> | 2017-02-17 10:58:25 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2017-02-24 16:09:23 +0100 |
commit | 70b27f364315e4ad4cb77cdebe530e5bdbdf3dcb (patch) | |
tree | 675be52d7c99d390f465a26603c1a58ecc2f1fc8 /block | |
parent | 7dad9ee6467e0e3024fbe09f8a363148558b8eef (diff) |
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>
Diffstat (limited to 'block')
-rw-r--r-- | block/qcow2.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/block/qcow2.c b/block/qcow2.c index 3e274bd1ba..254545a83b 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -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; } |