Hello, Are you sure that your init script is running at VM startup? If so, be sure to 'source' the file context.sh that contains $HOSTNAME definition, before running your script.
If you are using hdc as your device where the contextualization image will be available, you can use something like this at startup: #!/bin/sh -e mount -t iso9660 /dev/sdc /mnt if [ -f /mnt/context.sh ]; then . /mnt/init.sh fi umount /mnt exit 0 Take a look at last section (EXAMPLE) here: http://opennebula.org/documentation:archives:rel3.2:cong For opensuse init script, read this: http://www.novell.com/coolsolutions/feature/15380.html Regars, Pedro Vitti On Tue, Apr 17, 2012 at 5:56 AM, biro lehel <[email protected]> wrote: > Hello again, > > I currently have an init script which I copy to the newly instantiated VM > using the template's contextualization (FILES=.../init.sh). This script > contains (among others) the following section: > > if [ -n "$HOSTNAME" ]; then > hostname $HOSTNAME > > HOSTNAME is also a contextualized parameter, as I set HOSTNAME=MyHostName > also in the contextualization section of my VM's template. > I would expect this to set my hostname as MyHostName on the instantiated > VM. However, the hostname remains the same (meaning it still remains the > same hostname as it is in my image that the respective template uses). > > I'm using openSUSE 11.4 and OpenNebula 3.2.0. > > What are the other ways to try to set the hostname in my VM's? Since more > VM's will use the same image, I cannot simply set it in my image. Is > anything need to be done regarding the hostname in the respective image? > > Thanks, > Lehel. > > > _______________________________________________ > 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
