[one-users] Trouble setting VM's hostname

Olivier Sallou olivier.sallou at irisa.fr
Tue Apr 17 23:14:08 PDT 2012



Le 4/17/12 11:57 PM, Pedro Vitti a écrit :
> 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 <lehel.biro at yahoo.com
> <mailto:lehel.biro at yahoo.com>> 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
>

Just as a hint, a hostname cannot contain underscores (maybe not your
case but I once faced the issue....)

Olivier
>
>
>     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
>     Users at lists.opennebula.org <mailto:Users at lists.opennebula.org>
>     http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org

-- 
Olivier Sallou
IRISA / University of Rennes 1
Campus de Beaulieu, 35000 RENNES - FRANCE
Tel: 02.99.84.71.95

gpg key id: 4096R/326D8438  (keyring.debian.org)
Key fingerprint = 5FB4 6F83 D3B9 5204 6335  D26D 78DC 68DB 326D 8438


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20120418/aeb62e72/attachment-0003.htm>


More information about the Users mailing list