Ok, so I will check that the generated IP is the one expected from the leases list based on this script algorithm.<div>Is the VM is exploded somewhere at startup? If yes, where?<br><br><div class="gmail_quote">On Wed, Dec 15, 2010 at 11:19 AM, Gian Uberto Lauri <span dir="ltr"><<a href="mailto:saint@eng.it">saint@eng.it</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">[My apologies for breaking the threading informations]<br>
<br></div>
CH> What I understand is that the init.sh script provided in<br>
CH> <a href="http://dev.opennebula.org/attachments/download/170/ttylinux.tar.gz" target="_blank">http://dev.opennebula.org/attachments/download/170/ttylinux.tar.gz</a><br>
CH> is just useful in context based VM and is not used in my case.<br>
CH> Where can I look to the VM configuration file once it is started?<br>
CH> Is iy exploded somewhere so I can have a look to files?<br>
<br>
The content of the script that's run on the first boot of the VM after<br>
sourcing the file in the iso image:<br>
<br>
----------------------------------8<---------------------------<br>
#!/bin/bash<br>
#<br>
# chkconfig: 2345 10 90<br>
# description:  network reconfigure<br>
#<br>
# -------------------------------------------------------------------------- #<br>
# Copyright 2002-2009, Distributed Systems Architecture Group, Universidad   #<br>
# Complutense de Madrid (<a href="http://dsa-research.org" target="_blank">dsa-research.org</a>)                                   #<br>
#                                                                            #<br>
# Licensed under the Apache License, Version 2.0 (the "License"); you may    #<br>
# not use this file except in compliance with the License. You may obtain    #<br>
# a copy of the License at                                                   #<br>
#                                                                            #<br>
# <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">http://www.apache.org/licenses/LICENSE-2.0</a>                                 #<br>
#                                                                            #<br>
# Unless required by applicable law or agreed to in writing, software        #<br>
# distributed under the License is distributed on an "AS IS" BASIS,          #<br>
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #<br>
# See the License for the specific language governing permissions and        #<br>
# limitations under the License.                                             #<br>
#--------------------------------------------------------------------------- #<br>
<br>
# Gets IP address from a given MAC<br>
mac2ip() {<br>
    mac=$1<br>
<br>
    let ip_a=0x`echo $mac | cut -d: -f 3`<br>
    let ip_b=0x`echo $mac | cut -d: -f 4`<br>
    let ip_c=0x`echo $mac | cut -d: -f 5`<br>
    let ip_d=0x`echo $mac | cut -d: -f 6`<br>
<br>
    ip="$ip_a.$ip_b.$ip_c.$ip_d"<br>
<br>
    echo $ip<br>
}<br>
<br>
# Gets the network part of an IP<br>
get_network() {<br>
    IP=$1<br>
<br>
    echo $IP | cut -d'.' -f1,2,3<br>
}<br>
<br>
get_interfaces() {<br>
    IFCMD="/sbin/ifconfig -a"<br>
<br>
    $IFCMD | grep ^eth | sed 's/ *Link encap:Ethernet.*HWaddr /-/g'<br>
}<br>
<br>
get_dev() {<br>
    echo $1 | cut -d'-' -f 1<br>
}<br>
<br>
get_mac() {<br>
    echo $1 | cut -d'-' -f 2<br>
}<br>
<br>
gen_hosts() {<br>
    NETWORK=$1<br>
    echo "127.0.0.1 localhost"<br>
    for n in `seq -w 01 99`; do<br>
        n2=`echo $n | sed 's/^0*//'`<br>
        echo ${NETWORK}.$n2 cluster${n}<br>
    done<br>
}<br>
<br>
gen_exports() {<br>
    NETWORK=$1<br>
    echo "/images ${NETWORK}.0/<a href="http://255.255.255.0" target="_blank">255.255.255.0</a>(rw,async,no_subtree_check)"<br>
}<br>
<br>
gen_hostname() {<br>
    MAC=$1<br>
    NUM=`mac2ip $MAC | cut -d'.' -f4`<br>
    NUM2=`echo 000000$NUM | sed 's/.*\(..\)/\1/'`<br>
    echo cluster$NUM2<br>
}<br>
<br>
gen_interface() {<br>
 DEV_MAC=$1<br>
 DEV=`get_dev $DEV_MAC`<br>
 MAC=`get_mac $DEV_MAC`<br>
 IP=`mac2ip $MAC`<br>
<br>
# dumping the values into the reddattish file<br>
cat <<EOT<br>
 DEVICE=$DEV<br>
 BOOTPROTO=none<br>
 HWADDR=$MAC<br>
 ONBOOT=yes<br>
 TYPE=Ethernet<br>
 NETMASK=255.255.255.0<br>
 IPADDR=$IP<br>
EOT<br>
<br>
    if [ $DEV == "eth0" ]; then<br>
      echo " GATEWAY=$NETWORK.1"<br>
    fi<br>
<br>
echo ""<br>
}<br>
<br>
<br>
IFACES=`get_interfaces`<br>
<br>
for i in $IFACES; do<br>
    MASTER_DEV_MAC=$i<br>
    DEV=`get_dev $i`<br>
    MAC=`get_mac $i`<br>
    IP=`mac2ip $MAC`<br>
    NETWORK=`get_network $IP`<br>
done<br>
<br>
# gen_hosts $NETWORK > /etc/hosts<br>
<br>
# gen_exports $NETWORK  > /etc/exports<br>
<br>
# gen_hostname $MAC  > /etc/hostname<br>
(<br>
cat <<EOT<br>
<br>
EOT<br>
<br>
for i in $IFACES; do<br>
    gen_interface $i<br>
done<br>
) > /etc/sysconfig/network-scripts/ifcfg-${DEV}<br>
<br>
#ifdown $DEV<br>
#ifup $DEV<br>
<br>
exit $RETVAL<br>
# /bin/hostname `cat /etc/hostname`<br>
----------------------------------8<---------------------------<br>
<br>
I have to investigate other means of accessing the VM console, since we plan<br>
to use OpenNebula to offer Windows virtualization and this script does not cope<br>
with Windows bootstrap process AFAIK.<div><div></div><div class="h5"><br>
<br>
--<br>
ing. Gian Uberto Lauri<br>
Ricercatore / Reasearcher<br>
Divisione Ricerca ed Innovazione / Research & Innovation Division<br>
<a href="mailto:GianUberto.Lauri@eng.it" target="_blank">GianUberto.Lauri@eng.it</a><br>
<br>
Engineering Ingegneria Informatica spa<br>
Corso Stati Uniti 23/C, 35127 Padova (PD)<br>
<br>
Tel. +39-049.8283.538         | main(){printf(&unix["\021%six\012\0"],<br>
Fax  +39-049.8283.569             |    (unix)["have"]+"fun"-0x60);}<br>
Skype: gian.uberto.lauri          |          David Korn, AT&T Bell Labs<br>
<a href="http://www.eng.it" target="_blank">http://www.eng.it</a>                         |          ioccc best One Liner, 1987<br>
<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opennebula.org" target="_blank">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>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><span style="font-family:Helvetica;font-size:12px"><div>Christophe Hamerling </div><div>R&D Engineer & Project Leader</div><div>Petals Link - SOA open-source company</div>
<div>OW2 PEtALS SOA Suite Comitter</div><div>Skype : christophe.hamerling</div><div>Jabber : <a href="mailto:chamerling@jabber.org" target="_blank">chamerling@jabber.org</a></div><div>Blog : <a href="http://chamerling.org" target="_blank">http://chamerling.org</a></div>
</span><br>
</div>