<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 17, 2016 at 6:01 PM, Richard W.M. Jones <span dir="ltr"><<a href="mailto:rjones@redhat.com" target="_blank">rjones@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, May 17, 2016 at 05:53:31PM +0300, Yaniv Kaul wrote:<br>
> On Tue, May 17, 2016 at 5:48 PM, Richard W.M. Jones <<a href="mailto:rjones@redhat.com">rjones@redhat.com</a>><br>
> wrote:<br>
><br>
> > On Tue, May 17, 2016 at 03:41:53PM +0100, Richard W.M. Jones wrote:<br>
> > > On Tue, May 17, 2016 at 05:15:57PM +0300, Yaniv Kaul wrote:<br>
> > > > When creating qcow2 images using virt-builder, is there a way to<br>
> > specify<br>
> > > > the qcow2 preallocation, as possible with qemu-img create -o<br>
> > > > preallocation=metada , for example?<br>
> > ><br>
> > > No .. but .. it does default to preallocation=metadata provided that<br>
> > > the output format is qcow2:<br>
> > ><br>
> > ><br>
> > <a href="https://github.com/libguestfs/libguestfs/blob/master/builder/builder.ml#L582-L585" rel="noreferrer" target="_blank">https://github.com/libguestfs/libguestfs/blob/master/builder/builder.ml#L582-L585</a><br>
> ><br>
> > I should say this only applies when the image needs to be resized<br>
> > (ie. you supply a --size parameter which != the size of the template),<br>
> > AND if the resize is the final step that the planner comes up with.<br>
> ><br>
> ><br>
> > <a href="https://rwmj.wordpress.com/2013/12/14/writing-a-planner-to-solve-a-tricky-programming-optimization-problem/" rel="noreferrer" target="_blank">https://rwmj.wordpress.com/2013/12/14/writing-a-planner-to-solve-a-tricky-programming-optimization-problem/</a><br>
><br>
><br>
> Oh. I don't think there[1] is any need to resize in the code, it's just<br>
> directly using the templates virt-builder uses, AFAIK.<br>
<br>
</span>The problem is:  Suppose the input template is already qcow2, and the<br>
output format requested is qcow2, virt-builder will just copy the<br>
input to the output and not do any preallocation.<br></blockquote><div><br></div><div>I expect the input images virt-builder uses (by default) to have preallocation=metadata.</div><div><br></div><div>(Then again, I expected RHEL, CentOS and Fedora cloud images to be qcow2v3 - and they aren't - just plain 0.1 compat level).</div><div>Y.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
To force a particular preallocation mode for the output image, an<br>
extra step might be required, and that would have to be modelled in<br>
the planner.<br>
<br>
The blog post above is quite interesting.  Though Wordpress in its<br>
infinite wisdom decided to break the diagram.  You can see the diagram<br>
here: <a href="http://oirase.annexia.org/rwmj.wp.com/strips.svg" rel="noreferrer" target="_blank">http://oirase.annexia.org/rwmj.wp.com/strips.svg</a><br>
<br>
Rich.<br>
<span class="im HOEnZb"><br>
><br>
> [1]<br>
> <a href="https://github.com/lago-project/lago-images/blob/inital-setup/bin/build.py" rel="noreferrer" target="_blank">https://github.com/lago-project/lago-images/blob/inital-setup/bin/build.py</a><br>
><br>
><br>
> ><br>
> > In the general case implementing this is more complicated.  I think it<br>
> > would require another planner transition.<br>
> ><br>
> > Rich.<br>
> ><br>
> > --<br>
> > Richard Jones, Virtualization Group, Red Hat<br>
> > <a href="http://people.redhat.com/~rjones" rel="noreferrer" target="_blank">http://people.redhat.com/~rjones</a><br>
> > Read my programming and virtualization blog: <a href="http://rwmj.wordpress.com" rel="noreferrer" target="_blank">http://rwmj.wordpress.com</a><br>
> > virt-top is 'top' for virtual machines.  Tiny program with many<br>
> > powerful monitoring features, net stats, disk stats, logging, etc.<br>
> > <a href="http://people.redhat.com/~rjones/virt-top" rel="noreferrer" target="_blank">http://people.redhat.com/~rjones/virt-top</a><br>
> ><br>
<br>
--<br>
Richard Jones, Virtualization Group, Red Hat <a href="http://people.redhat.com/~rjones" rel="noreferrer" target="_blank">http://people.redhat.com/~rjones</a><br>
Read my programming and virtualization blog: <a href="http://rwmj.wordpress.com" rel="noreferrer" target="_blank">http://rwmj.wordpress.com</a><br>
</span><div class="HOEnZb"><div class="h5">virt-df lists disk usage of guests without needing to install any<br>
software inside the virtual machine.  Supports Linux and Windows.<br>
<a href="http://people.redhat.com/~rjones/virt-df/" rel="noreferrer" target="_blank">http://people.redhat.com/~rjones/virt-df/</a><br>
</div></div></blockquote></div><br></div></div>