qemu-discuss
[Top][All Lists]
Advanced

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

Re: [Qemu-discuss] [Qemu-devel] Estimation of qcow2 image size converted


From: Daniel P. Berrange
Subject: Re: [Qemu-discuss] [Qemu-devel] Estimation of qcow2 image size converted from raw image
Date: Wed, 15 Feb 2017 16:07:43 +0000
User-agent: Mutt/1.7.1 (2016-10-04)

On Wed, Feb 15, 2017 at 05:57:12PM +0200, Nir Soffer wrote:
> On Wed, Feb 15, 2017 at 5:20 PM, Daniel P. Berrange <address@hidden> wrote:
> > On Wed, Feb 15, 2017 at 03:14:19PM +0000, Stefan Hajnoczi 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
> >>
> >> As John explained, it is only an estimate.  But it will be a
> >> conservative maximum.
> >
> > This forces you to have an input file. It would be nice to be able to
> > get the same information by merely giving the desired capacity e.g
> >
> >   $ qemu-img query-max-size -O qcow2 20G
> 
> Without a file, this will have to assume that all clusters will be allocated.
> 
> Do you have a use case for not using existing file?

If you want to format a new qcow2 file in a pre-created block device you
want to know how big the block device should be. Or you want to validate
that the filesystem you're about to created it in will not become
overrcomitted wrt pre-existing guests. So you need to consider the FS
free space, vs query-max-size for all existing guest, combined with
query-max-size for the new disk you wan tto create


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|



reply via email to

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