Richard W.M. Jones
2016-May-17 15:01 UTC
Re: [Libguestfs] Can I specify qcow2 preallocation method with virt-builder?
On Tue, May 17, 2016 at 05:53:31PM +0300, Yaniv Kaul wrote:> 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.The problem is: Suppose the input template is already qcow2, and the output format requested is qcow2, virt-builder will just copy the input to the output and not do any preallocation. To force a particular preallocation mode for the output image, an extra step might be required, and that would have to be modelled in the planner. The blog post above is quite interesting. Though Wordpress in its infinite wisdom decided to break the diagram. You can see the diagram here: http://oirase.annexia.org/rwmj.wp.com/strips.svg Rich.> > [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 > >-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
Yaniv Kaul
2016-May-17 15:03 UTC
Re: [Libguestfs] Can I specify qcow2 preallocation method with virt-builder?
On Tue, May 17, 2016 at 6:01 PM, Richard W.M. Jones <rjones@redhat.com> wrote:> On Tue, May 17, 2016 at 05:53:31PM +0300, Yaniv Kaul wrote: > > 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. > > The problem is: Suppose the input template is already qcow2, and the > output format requested is qcow2, virt-builder will just copy the > input to the output and not do any preallocation. >I expect the input images virt-builder uses (by default) to have preallocation=metadata. (Then again, I expected RHEL, CentOS and Fedora cloud images to be qcow2v3 - and they aren't - just plain 0.1 compat level). Y.> > To force a particular preallocation mode for the output image, an > extra step might be required, and that would have to be modelled in > the planner. > > The blog post above is quite interesting. Though Wordpress in its > infinite wisdom decided to break the diagram. You can see the diagram > here: http://oirase.annexia.org/rwmj.wp.com/strips.svg > > Rich. > > > > > [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 > > > > > -- > Richard Jones, Virtualization Group, Red Hat > http://people.redhat.com/~rjones > Read my programming and virtualization blog: http://rwmj.wordpress.com > virt-df lists disk usage of guests without needing to install any > software inside the virtual machine. Supports Linux and Windows. > http://people.redhat.com/~rjones/virt-df/ >
Richard W.M. Jones
2016-May-17 15:11 UTC
Re: [Libguestfs] Can I specify qcow2 preallocation method with virt-builder?
On Tue, May 17, 2016 at 06:03:16PM +0300, Yaniv Kaul wrote:> I expect the input images virt-builder uses (by default) to have > preallocation=metadata.The default images we supply on http://libguestfs.org are raw sparse. However maybe you've got your own templates, in which case you can control the format and preallocation as you like. However it's still possible that virt-builder might "lose" the preallocation mode when it performs the steps in the plan (although I can't at the moment see any case where this would really happen if you start with qcow2 templates and ask for qcow2 output format). The only way I can see to deal with this reliably is to model it in the planner tags + transitions function. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Possibly Parallel Threads
- Re: Can I specify qcow2 preallocation method with virt-builder?
- Re: Can I specify qcow2 preallocation method with virt-builder?
- Re: Can I specify qcow2 preallocation method with virt-builder?
- Re: Can I specify qcow2 preallocation method with virt-builder?
- Can I specify qcow2 preallocation method with virt-builder?