mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-18 07:32:06 -06:00
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>
This commit is contained in:
parent
7dad9ee646
commit
70b27f3643
1 changed files with 5 additions and 1 deletions
|
@ -3250,7 +3250,11 @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_size) {
|
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) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue