[one-users] RFC: Feature idea - Image preparation

Carlos Martín Sánchez cmartin at opennebula.org
Tue May 28 06:07:42 PDT 2013


Hi,

I just want to give you some general advice here: use hooks and drivers as
much as possible.

For example, instead of adding a new xml-rpc call, oca method, CLI and
sunstone, you could simply add a new attribute to the Image or VM template.
MAKE_GOLDEN = YES or similar.
Doing this, you can forget about the user interface.

Then you can look for that attribute when the VM is shutdown.
This could be done editing the 'mvds' TM script [1], the one executed for
the epilog phase. Or implement a hook [2] to be triggered after a VM is
shut down.


Good luck, and keep us posted with your progress!


[1] http://opennebula.org/documentation:rel4.0:sd
[2] http://opennebula.org/documentation:rel4.0:hooks

--
Join us at OpenNebulaConf2013 <http://opennebulaconf.com> in Berlin, 24-26
September, 2013
--
Carlos Martín, MSc
Project Engineer
OpenNebula - The Open-source Solution for Data Center Virtualization
www.OpenNebula.org | cmartin at opennebula.org |
@OpenNebula<http://twitter.com/opennebula><cmartin at opennebula.org>


On Thu, May 23, 2013 at 7:13 AM, Jon <three18ti at gmail.com> wrote:

> Hello All,
>
> Before I was using Open Nebula, my general virtual machine workflow was as
> follows:
>
> 1)  Install OS to qcow image, this creates an image between 500-1500MB
> 2)  "Unconfigure" virtual machine, e.g. remove any system specific config:
> udev rules, user accounts, ssh host keys, SELinux relabel etc.
> 3)  Zero out the file system by creating a large file of all zeros, e.g.:
> dd if=/dev/zero of=./delme; rm delme
> 4)  Compress and (qemu-img reclaims unused space while compressing so the
> "sparsify" is implied) the image, to create a "master" image (I've heard
> this referred to as a "golden" image)
>            this typically results in an image between 300-500MB,
> e.g. qemu-img convert -c -f qcow2 master.qcow2 -O qcow2
> master.compressed.qcow2
> 5)  Create a "slave" copy on write image off the master, e.g.:  qemu-img
> create -b ../master/master.compressed.qcow2 -f qcow2 ./virtualmachine.qcow2
>           This results in all of the changes being written to
> ./virtualmachine.qcow2
>
> Fortunately, virt-sysprep and virt-sparsify handle steps 2 and 3 and the
> sparcify part of step 4 more or less mindlessly.
> qemu-img is still required (as far as I know) to compress the image, but
> there is no longer a need to be in the vm to zero out the image,
> so this whole process can be automated through a management layer like
> OpenNebula.
>
> I would like to automate this work flow through OpenNebula.  I think it
> would be extremely useful to be able to prepare and "finalize" a virtual
> machine from OpenNebula.
> Finalizing an image in this manner allows for maximization of disk space
> as well as use as a "master" or "golden" image.
> In my mind, I think it makes sense to use the least amount of space for
> the common filesystem pieces.
>
> Basically, when I create a new image in OpenNebula, I create a template
> with the iso and a blank persistent datablock, then instantiate the vm,
> install the iso,
> shutdown the vm, and flip the image to a nonpersistent OS.
>
> What I am proposing is a feature that would add an additional step that
> would allow a user to "finalize" the vm by "virt-sysprep"ing,
> "virt-sparsify"ing,
> and compressing the image, to maximize space usage.
>
> -- My goal is to have a cli command, e.g.: `onevm finalize 38` or `onevm
> finilize ubuntu-server-13.04` as well as an option in Sunstone to finalize
> the image.
> It would effectively finalize and clone the vm so, if necessary, the
> original can still be modified and finalized again.
>
> Does any one have any other ideas, thoughts, comments, or suggestions for
> an image "finalization" function?  Is there anything I'm not thinking about
> that I should be?
>
> As far as development of the feature is concerned, where would I create
> this feature for a commandline function, can you point me at some useful
> documentation for developing this kind of feature?
> I'm not ready to tackle the sunstone piece of this yet I don't think, so I
> think my focus will be on the command line function for now.
>
> Thanks for your input,
> Jon A
>
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20130528/b7f4381c/attachment-0002.htm>


More information about the Users mailing list