Hello,<br><br>Are you sure that your init script is running at VM startup? <br>If so, be sure to 'source' the file context.sh that contains $HOSTNAME definition, before running your script.<br><br>If you are using hdc as your device where the contextualization image will be available, you can use something like this at startup:<br>
<br><span style="color:rgb(0,0,0)">#!/bin/sh -e</span><br style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,0,0)"><br>mount -t iso9660 /dev/sdc /mnt</span><br style="color:rgb(0,0,0)">
<span style="color:rgb(0,0,0)"> </span><br style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)">if [ -f /mnt/context.sh ]; then</span><br style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)"> . /mnt/init.sh</span><br style="color:rgb(0,0,0)">
<span style="color:rgb(0,0,0)">fi</span><br style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)"> </span><br style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)">umount /mnt</span><br style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)"></span><span style="color:rgb(0,0,0)">exit 0<br>
<br></span>Take a look at last section (EXAMPLE) here: <a href="http://opennebula.org/documentation:archives:rel3.2:cong">http://opennebula.org/documentation:archives:rel3.2:cong</a><br>For opensuse init script, read this: <a href="http://www.novell.com/coolsolutions/feature/15380.html">http://www.novell.com/coolsolutions/feature/15380.html</a><br>
<div class="gmail_quote"><br>Regars,<br>Pedro Vitti<br><br>On Tue, Apr 17, 2012 at 5:56 AM, biro lehel <span dir="ltr"><<a href="mailto:lehel.biro@yahoo.com">lehel.biro@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font:inherit" valign="top">Hello again,<br><br>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:<br>
<br><span style="font-family:courier,monaco,monospace,sans-serif">if [ -n "$HOSTNAME" ]; then</span><br style="font-family:courier,monaco,monospace,sans-serif"><span style="font-family:courier,monaco,monospace,sans-serif"> hostname $HOSTNAME</span><br>
<br>HOSTNAME is also a contextualized parameter, as I set HOSTNAME=MyHostName also in the contextualization section of my VM's template.<br>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).<br>
<br>I'm using
openSUSE 11.4 and OpenNebula 3.2.0.<br><br>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?<br>
<br>Thanks, <br>Lehel.<br><br></td></tr></tbody></table><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>