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

Jon three18ti at gmail.com
Wed May 22 22:13:41 PDT 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20130522/d1f557cc/attachment.htm>


More information about the Users mailing list