On Tue, May 17, 2016 at 5:48 PM, Richard W.M. Jones <rjones@redhat.com> wrote:
On Tue, May 17, 2016 at 03:41:53PM +0100, Richard W.M. Jones wrote:
> On Tue, May 17, 2016 at 05:15:57PM +0300, Yaniv Kaul wrote:
> > When creating qcow2 images using virt-builder, is there a way to specify
> > the qcow2 preallocation, as possible with qemu-img create -o
> > preallocation=metada , for example?
>
> No .. but .. it does default to preallocation=metadata provided that
> the output format is qcow2:
>
> https://github.com/libguestfs/libguestfs/blob/master/builder/builder.ml#L582-L585

I should say this only applies when the image needs to be resized
(ie. you supply a --size parameter which != the size of the template),
AND if the resize is the final step that the planner comes up with.

https://rwmj.wordpress.com/2013/12/14/writing-a-planner-to-solve-a-tricky-programming-optimization-problem/

Oh. I don't think there[1] is any need to resize in the code, it's just directly using the templates virt-builder uses, AFAIK.
Y.

[1] https://github.com/lago-project/lago-images/blob/inital-setup/bin/build.py 



In the general case implementing this is more complicated.  I think it
would require another planner transition.

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top