On 2017-07-05 14:57, Stefan Hajnoczi wrote: > v9: > * Fix swapped fmt <-> output_fmt parameters in documentation [Max]
Oh, it was just the wrong way around there. > * Clarify that backing file clusters also available in the new image > file *may* be ommitted from the calculation [Max] [...] > Users and management tools sometimes need to know the size required for a new > disk image so that an LVM volume, SAN LUN, etc can be allocated ahead of time. > Image formats like qcow2 have non-trivial metadata that makes it hard to > estimate the exact size without knowledge of file format internals. > > This patch series introduces a new qemu-img sub-command that calculates the > required size for both image creation and conversion scenarios. > > The conversion scenario is: > > $ qemu-img measure -f raw -O qcow2 input.img > required size: 1327680 > fully allocated size: 1074069504 > > Here an existing image file is taken and the output includes the space > required > for data from the input image file. > > The creation scenario is: > > $ qemu-img measure -O qcow2 --size 5G > required size: 327680 > fully allocated size: 1074069504 > > Stefan Hajnoczi (9): > block: add bdrv_measure() API > raw-format: add bdrv_measure() support > qcow2: extract preallocation calculation function > qcow2: make refcount size calculation conservative > qcow2: extract image creation option parsing > qcow2: add bdrv_measure() support > qemu-img: add measure subcommand > qemu-iotests: support per-format golden output files > iotests: add test 178 for qemu-img measure > > qapi/block-core.json | 25 +++ > include/block/block.h | 2 + > include/block/block_int.h | 2 + > block.c | 35 ++++ > block/qcow2.c | 383 > +++++++++++++++++++++++++++++---------- > block/raw-format.c | 26 +++ > qemu-img.c | 234 ++++++++++++++++++++++++ > qemu-img-cmds.hx | 6 + > qemu-img.texi | 30 +++ > tests/qemu-iotests/178 | 170 +++++++++++++++++ > tests/qemu-iotests/178.out.qcow2 | 286 +++++++++++++++++++++++++++++ > tests/qemu-iotests/178.out.raw | 158 ++++++++++++++++ > tests/qemu-iotests/check | 5 + > tests/qemu-iotests/group | 1 + > 14 files changed, 1268 insertions(+), 95 deletions(-) > create mode 100755 tests/qemu-iotests/178 > create mode 100644 tests/qemu-iotests/178.out.qcow2 > create mode 100644 tests/qemu-iotests/178.out.raw Thanks, applied to my block tree: https://github.com/XanClic/qemu/commits/block Max
signature.asc
Description: OpenPGP digital signature