From: Nir Soffer <nsoffer@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Maor Lipchuk <mlipchuk@redhat.com>,
qemu-devel@nongnu.org, qemu-discuss@nongnu.org,
Kevin Wolf <kwolf@redhat.com>,
Allon Mureinik <amureini@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] Estimation of qcow2 image size converted from raw image
Date: Wed, 15 Feb 2017 17:49:58 +0200 [thread overview]
Message-ID: <CAMRbyysZUv1YQa+veW--K9FDDLkXnY5TCSmTS4xPb1sB6kODcw@mail.gmail.com> (raw)
In-Reply-To: <20170215151419.GD16064@stefanha-x1.localdomain>
On Wed, Feb 15, 2017 at 5:14 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> On Mon, Feb 13, 2017 at 05:46:19PM +0200, Maor Lipchuk wrote:
>> I was wondering if that is possible to provide a new API that
>> estimates the size of
>> qcow2 image converted from a raw image. We could use this new API to
>> allocate the
>> size more precisely before the convert operation.
>>
> [...]
>> We think that the best way to solve this issue is to return this info
>> from qemu-img, maybe as a flag to qemu-img convert that will
>> calculate the size of the converted image without doing any writes.
>
> Sounds reasonable. qcow2 actually already does some of this calculation
> internally for image preallocation in qcow2_create2().
>
> Let's try this syntax:
>
> $ qemu-img query-max-size -f raw -O qcow2 input.raw
> 1234678000
This is little bit verbose compared to other commands
(e.g. info, check, convert)
Since this is needed only during convert, maybe this can be
a convert flag?
qemu-img convert -f xxx -O yyy src dst --estimate-size --output json
{
"estimated size": 1234678000
}
> As John explained, it is only an estimate. But it will be a
> conservative maximum.
>
> Internally BlockDriver needs a new interface:
>
> struct BlockDriver {
> /*
> * Return a conservative estimate of the maximum host file size
> * required by a new image given an existing BlockDriverState (not
> * necessarily opened with this BlockDriver).
> */
> uint64_t (*bdrv_query_max_size)(BlockDriverState *other_bs,
> Error **errp);
> };
>
> This interface allows individual block drivers to probe other_bs in
> whatever way necessary (e.g. querying block allocation status).
>
> Since this is a conservative max estimate there's no need to read all
> data to check for zero regions. We should give the best estimate that
> can be generated quickly.
I think we need to check allocation (e.g. with SEEK_DATA), I hope this
is what you mean by not read all data.
Nir
next prev parent reply other threads:[~2017-02-15 15:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-13 15:46 [Qemu-devel] Estimation of qcow2 image size converted from raw image Maor Lipchuk
2017-02-13 17:03 ` John Snow
2017-02-13 17:16 ` Daniel P. Berrange
2017-02-13 18:26 ` John Snow
2017-02-15 15:14 ` Stefan Hajnoczi
2017-02-15 15:20 ` Daniel P. Berrange
2017-02-15 15:34 ` Eric Blake
2017-02-15 15:57 ` Nir Soffer
2017-02-15 16:05 ` [Qemu-devel] [Qemu-discuss] " Alberto Garcia
2017-02-15 16:11 ` Daniel P. Berrange
2017-02-15 16:07 ` [Qemu-devel] " Daniel P. Berrange
2017-02-20 11:12 ` Stefan Hajnoczi
2017-02-15 15:49 ` Nir Soffer [this message]
2017-02-20 11:07 ` Stefan Hajnoczi
[not found] ` <CAJ1JNOdzD7DHTHGJEO2YQANDPq0kY-PEh6J1jBkP7hUW0Kvy9w@mail.gmail.com>
[not found] ` <CAMRbyyssi_rspwDJTtWM1Ju5CTZ15z1xBikRDONrS84rx+B8Qg@mail.gmail.com>
2017-02-22 16:15 ` Maor Lipchuk
2017-02-22 22:06 ` Maor Lipchuk
2017-02-28 9:19 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMRbyysZUv1YQa+veW--K9FDDLkXnY5TCSmTS4xPb1sB6kODcw@mail.gmail.com \
--to=nsoffer@redhat.com \
--cc=amureini@redhat.com \
--cc=kwolf@redhat.com \
--cc=mlipchuk@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-discuss@nongnu.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).