On 8/06/2026 13:03, Jean-Louis Dupond wrote:
> In some cases we want to calculate the size an image will be after we commit A into B.
> This for example on block storage, where you need to resize the target storage before you start the merge.
>
> These commits adds the functionality to do this.
> First of all a commit that adds bdrv_open_backing_chain_until. So we can open an image up to base image B.
>
> And then a modified qcow2_measure that calculates the size of B after A has been merged into it.
> This with taking into account the discard-no-unref setting of the base.
>
> Jean-Louis Dupond (3):
> block: add bdrv_open_backing_chain_until
> block: support measure for commit
> iotests/290: add test case for qemu-img measure
>
> block.c | 65 +++++++++++++++++----
> block/mirror.c | 2 +-
> block/qcow2.c | 90 +++++++++++++++++++++++++++---
> include/block/block-global-state.h | 7 ++-
> qemu-img-cmds.hx | 4 +-
> qemu-img.c | 37 ++++++++++--
> tests/qemu-iotests/178.out.qcow2 | 6 +-
> tests/qemu-iotests/178.out.raw | 6 +-
> tests/qemu-iotests/290 | 45 +++++++++++++++
> tests/qemu-iotests/290.out | 61 ++++++++++++++++++++
> 10 files changed, 289 insertions(+), 34 deletions(-)
Kind ping