From 90880ff107ecaada2a06a823dc5fa652f6e37a62 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Wed, 5 Jul 2017 13:57:30 +0100 Subject: block: add bdrv_measure() API bdrv_measure() provides a conservative maximum for the size of a new image. This information is handy if storage needs to be allocated (e.g. a SAN or an LVM volume) ahead of time. Signed-off-by: Stefan Hajnoczi Reviewed-by: Alberto Garcia Message-id: 20170705125738.8777-2-stefanha@redhat.com Signed-off-by: Max Reitz --- qapi/block-core.json | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'qapi') diff --git a/qapi/block-core.json b/qapi/block-core.json index 4bf11e8b8b..c437aa50ef 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -487,6 +487,31 @@ '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus', '*dirty-bitmaps': ['BlockDirtyInfo'] } } +## +# @BlockMeasureInfo: +# +# Image file size calculation information. This structure describes the size +# requirements for creating a new image file. +# +# The size requirements depend on the new image file format. File size always +# equals virtual disk size for the 'raw' format, even for sparse POSIX files. +# Compact formats such as 'qcow2' represent unallocated and zero regions +# efficiently so file size may be smaller than virtual disk size. +# +# The values are upper bounds that are guaranteed to fit the new image file. +# Subsequent modification, such as internal snapshot or bitmap creation, may +# require additional space and is not covered here. +# +# @required: Size required for a new image file, in bytes. +# +# @fully-allocated: Image file size, in bytes, once data has been written +# to all sectors. +# +# Since: 2.10 +## +{ 'struct': 'BlockMeasureInfo', + 'data': {'required': 'int', 'fully-allocated': 'int'} } + ## # @query-block: # -- cgit v1.2.3-55-g7522