On 2017-06-14 17:35, Stefan Hajnoczi wrote: > The measure subcommand calculates the size required by a new image file. > This can be used by users or management tools that need to allocate > space on an LVM volume, SAN LUN, etc before creating or converting an > image file. > > Suggested-by: Maor Lipchuk <[email protected]> > Signed-off-by: Stefan Hajnoczi <[email protected]> > --- > v7: > * Really use UINT64_MAX everywhere instead of ~0ULL [Berto] > v5: > * Use UINT64_MAX instead of ~0ULL [Berto] > * Document qemu-img measure ofmt, fmt, output_fmt, and snapshot_param > [Berto] > --- > qemu-img.c | 234 > +++++++++++++++++++++++++++++++++++++++++++++++++++++++ > qemu-img-cmds.hx | 6 ++ > qemu-img.texi | 30 +++++++ > 3 files changed, 270 insertions(+)
[...]
> diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
> index a39fcdb..ac5946b 100644
> --- a/qemu-img-cmds.hx
> +++ b/qemu-img-cmds.hx
> @@ -63,6 +63,12 @@ STEXI
> @item map [--object @var{objectdef}] [--image-opts] [-f @var{fmt}]
> [--output=@var{ofmt}] [-U] @var{filename}
> ETEXI
>
> +DEF("measure", img_measure,
> +"measure [--output=ofmt] [-O output_fmt] [-o options] [--size N | [--object
> objectdef] [--image-opts] [-f fmt] [-l snapshot_param] filename]")
> +STEXI
> +@item measure [--output=@var{ofmt}] [-O @var{output_fmt}] [-o @var{options}]
> [--size @var{N} | [--object @var{objectdef}] [--image-opts] [-f @var{fmt}]
> [-l @var{snapshot_param}] @var{filename}]
> +ETEXI
> +
> DEF("snapshot", img_snapshot,
> "snapshot [--object objectdef] [--image-opts] [-U] [-q] [-l | -a
> snapshot | -c snapshot | -d snapshot] filename")
> STEXI
> diff --git a/qemu-img.texi b/qemu-img.texi
> index 5b925ec..3db035f 100644
> --- a/qemu-img.texi
> +++ b/qemu-img.texi
> @@ -438,6 +438,36 @@ preallocated.
> For more information, consult @file{include/block/block.h} in QEMU's
> source code.
>
> +@item measure [--output=@var{ofmt}] [-O @var{output_fmt}] [-o @var{options}]
> [--size @var{N} | [--object @var{objectdef}] [--image-opts] [-f @var{fmt}]
> [-l @var{snapshot_param}] @var{filename}]
> +
> +Calculate the file size required for a new image. This information can be
> used
> +to size logical volumes or SAN LUNs appropriately for the image that will be
> +placed in them. The values reported are guaranteed to be large enough to fit
> +the image. The command can output in the format @var{ofmt} which is either
> +@code{human} or @code{json}.
> +
> +If the size @var{N} is given then act as if creating a new empty image file
> +using @command{qemu-img create}. If @var{filename} is given then act as if
> +converting an existing image file using @command{qemu-img convert}. The
> format
> +of the new file is given by @var{fmt} while the format of an existing file is
> +given by @var{output_fmt}.
Sorry to reply so late (I wanted to take the series), but calling this
parameter output_fmt is weird. It is exactly the opposite.
Max
signature.asc
Description: OpenPGP digital signature
