Hello All,<div><br></div><div>Before I was using Open Nebula, my general virtual machine workflow was as follows:</div><div><br></div><div>1) Install OS to qcow image, this creates an image between 500-1500MB </div><div>2) "Unconfigure" virtual machine, e.g. remove any system specific config: udev rules, user accounts, ssh host keys, SELinux relabel etc.</div>
<div>3) Zero out the file system by creating a large file of all zeros, e.g.: dd if=/dev/zero of=./delme; rm delme</div><div>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) </div>
<div> this typically results in an image between 300-500MB, e.g. qemu-img convert -c -f qcow2 master.qcow2 -O qcow2 master.compressed.qcow2</div><div>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</div>
<div> This results in all of the changes being written to ./virtualmachine.qcow2</div><div><br></div><div>Fortunately, virt-sysprep and virt-sparsify handle steps 2 and 3 and the sparcify part of step 4 more or less mindlessly.</div>
<div>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, </div><div>so this whole process can be automated through a management layer like OpenNebula.</div>
<div><br></div><div>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.</div><div>Finalizing an image in this manner allows for maximization of disk space as well as use as a "master" or "golden" image.</div>
<div>In my mind, I think it makes sense to use the least amount of space for the common filesystem pieces.</div><div><br></div><div>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, </div>
<div>shutdown the vm, and flip the image to a nonpersistent OS.</div><div><br></div><div>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, </div>
<div>and compressing the image, to maximize space usage. </div><div><br></div><div>-- 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.</div>
<div>It would effectively finalize and clone the vm so, if necessary, the original can still be modified and finalized again.</div><div><br></div><div>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?</div>
<div><br></div><div>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?</div>
<div>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.</div><div><br></div><div>Thanks for your input,</div><div>Jon A</div>