<div dir="ltr">Hi,<div><br></div><div style>I just want to give you some general advice here: use hooks and drivers as much as possible.</div><div style><br></div><div style>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.</div>

<div style>Doing this, you can forget about the user interface.</div><div style><br></div><div style>Then you can look for that attribute when the VM is shutdown.</div><div style>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.</div>

<div style><br></div><div style><br></div><div style>Good luck, and keep us posted with your progress!</div><div style><br></div><div style><br></div><div style>[1] <a href="http://opennebula.org/documentation:rel4.0:sd">http://opennebula.org/documentation:rel4.0:sd</a><br>

</div><div style>[2] <a href="http://opennebula.org/documentation:rel4.0:hooks">http://opennebula.org/documentation:rel4.0:hooks</a><br></div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr">--<br>Join us at <a href="http://opennebulaconf.com" target="_blank">OpenNebulaConf2013</a> in Berlin, 24-26 September, 2013<br>

--<div>Carlos Martín, MSc<br>Project Engineer<br>OpenNebula - The Open-source Solution for Data Center Virtualization<div><span style="border-collapse:collapse;color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px"><a href="http://www.OpenNebula.org" target="_blank">www.OpenNebula.org</a> | <a href="mailto:cmartin@opennebula.org" target="_blank">cmartin@opennebula.org</a> | <a href="http://twitter.com/opennebula" target="_blank">@OpenNebula</a></span><span style="border-collapse:collapse;color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px"><a href="mailto:cmartin@opennebula.org" style="color:rgb(42,93,176)" target="_blank"></a></span></div>

</div></div></div>
<br><br><div class="gmail_quote">On Thu, May 23, 2013 at 7:13 AM, Jon <span dir="ltr"><<a href="mailto:three18ti@gmail.com" target="_blank">three18ti@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

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>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opennebula.org">Users@lists.opennebula.org</a><br>
<a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br>
<br></blockquote></div><br></div>