qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 7/9] qemu-img: add measure subcommand


From: Alberto Garcia
Subject: Re: [Qemu-devel] [PATCH v5 7/9] qemu-img: add measure subcommand
Date: Mon, 08 May 2017 16:17:34 +0200
User-agent: Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu)

On Tue 18 Apr 2017 03:57:24 PM CEST, 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 <address@hidden>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
> v5:
>  * Use UINT64_MAX instead of ~0ULL [Berto]
>  * Document qemu-img measure ofmt, fmt, output_fmt, and snapshot_param
>    [Berto]
> ---
  [...]
> +    QemuOptsList *create_opts = NULL;
> +    bool image_opts = false;
> +    uint64_t img_size = UINT64_MAX;

You are using UINT64_MAX here, but the rest of the function still uses
~0ULL.

> +        case OPTION_SIZE:
> +        {
> +            int64_t sval;
> +
> +            sval = cvtnum(optarg);
> +            if (sval < 0) {
> +                if (sval == -ERANGE) {
> +                    error_report("Image size must be less than 8 EiB!");
> +                } else {
> +                    error_report("Invalid image size specified! You may use "
> +                                 "k, M, G, T, P or E suffixes for ");
> +                    error_report("kilobytes, megabytes, gigabytes, 
> terabytes, "
> +                                 "petabytes and exabytes.");
> +                }
> +                goto out;
> +            }

I don't know if this is very important, but even under 8 EiB there are
image sizes that 'qemu-img measure' will treat as valid but are not
actually possible to create:

$ qemu-img measure -O qcow2 --size 7E
required size: 1231640938414080
fully allocated size: 8071682173186342912

$ build/qemu-img create -o cluster_size=2M -f qcow2 img.qcow2 7E
Formatting 'img.qcow2', fmt=qcow2 size=8070450532247928832 encryption=off 
cluster_size=2097152 lazy_refcounts=off refcount_bits=16
qemu-img: img.qcow2: The image size is too large for file format 'qcow2' (try 
using a larger cluster size)

Berto



reply via email to

[Prev in Thread] Current Thread [Next in Thread]