Hi, It looks like you could take adavantage of hooks [1]. This way you can perform preparative operations on create, running, etc., maybe storing some configurations files in $VAR_LOCATION/<vm-id>/ to be used later by your drivers.
I'm sorry I can't dedicate enough time to write a more elaborated mail; but please ask any other questions that may arise. Regards. [1] http://opennebula.org/documentation:rel2.2:hooks -- Carlos Martín, MSc Project Major Contributor OpenNebula - The Open Source Toolkit for Cloud Computing www.OpenNebula.org <http://www.opennebula.org/> | [email protected] On Sat, Jun 11, 2011 at 4:30 PM, <[email protected]> wrote: > Tino Vazquez wrote on 09/06/11 13:52: > >> Hi Nikolai, >> > Hi Tino, > > I am not sure any longer that functionality I was going to implement can be > done in tm_clone.sh script. Apart from possibility to be aware of > $SCRIPT_REMOTE_DIR value the tm_clone.sh script needs to "know" the name of > OS image to be used for VM deployment and that is a problem. > Let me briefly explain what I mean. > To create new VM on OpenVZ host there are two options: > 1) one can specify using 'ostemplate' option the name of already existing > so called OS template which has to be available in predefined dir set in > TEMPLATE variable of OpenVZ global config file (by default it is > /etc/vz/vz.conf). Normally TEMPLATE=/vz/template and OS template has to be > available in $TEMPLATE/cache. There is no way to specify the absolute path > to OS template (like --ostemplate=$VM_DIR/<$VMID>/images/disk.0 replacing > the variables $VM_DIR and $VMID by their values e.g. > --ostemplate=/vz/one/vm/55/images/disk.0). One of the example of a proper > command could be as > $ vzctl create 101 --ostemplate centos-5-x86 > and OpenVZ expects the existence of the > /vz/template/cache/centos-5-x86.tar.gz file with corresponding name. > 2) one can skip --ostemplate option. Then OpenVZ will use the default OS > template name defined in $DEF_OSTEMPLATE variable in /etc/vz/vz.conf. But > that way is not very flexible (althrough it can be followed if all VMs are > going to be deployed using only single OS template and thus its name can be > redefined ones during initial OpenVZ host configuration). > To follow the first option I would implement the logic as described below: > 1) get the name of OS template specified in config file for given VM; > 2) check if OS template with same name already exists in $TEMPLATE/cache > dir. If it does then rename it, create a symlink (or one can copy it) from > $VM_DIR/$VMID/images/disk.0 to $TEMPLATE/cache; > 3) create VM; > 4) remove symlinked OS template images from $TEMPLATE/cache dir. > > But tm_clone.sh script is executed before $SCRIPT_REMOTE_DIR/vmm/ovz/deploy > script and hense the VM config file is not yet available to retrieve OS > template name. Moreover the fourth step (OS template deletion from > $TEMPLATE/cach dir) needs to be executed after VM creation. So all the steps > described above needs to be implemented in $SCRIPT_REMOTE_DIR/vmm/ovz/deploy > script although such approach in some sense mixes functionality which each > script was initially intended for (as far as I understand it). > > Regards, > Nikolay. > _______________________________________________ > Users mailing list > [email protected] > http://lists.opennebula.org/listinfo.cgi/users-opennebula.org >
_______________________________________________ Users mailing list [email protected] http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
