]> xenbits.xensource.com Git - xentesttools/bootstrap.git/commitdiff
network-setup: Make the amount of NICs that are DHCP be 3 and use a global variable...
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tue, 24 Jan 2012 16:03:13 +0000 (11:03 -0500)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 25 Jan 2012 03:07:09 +0000 (22:07 -0500)
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
root_image/etc/init.d/primary_network

index 37be55356faa68309b7a13926a1be0080b3e0438..596b95c6b98e4d5453a2017e1101aec643448986 100755 (executable)
@@ -2,6 +2,8 @@
 
 . /etc/init.d/functions
 
+MAX_NICS=3
+
 function create_bridge() {
 
        local name=$1
@@ -24,7 +26,7 @@ function create_bridge_if() {
        echo "ONBOOT=yes" >> $FILE
        echo "BRIDGE=$name" >> $FILE
 
-       COUNT=0
+       COUNT=1
        NICS=`ls -1 /sys/class/net/ | grep -v lo | grep -v sit`
        # The rest
        for NIC in $NICS
@@ -39,7 +41,7 @@ function create_bridge_if() {
                COUNT=$(($COUNT+1))
                # We only want at max two DHCP interfaces.
                # switch and ethX
-               if [ $COUNT -ge 1 ]; then
+               if [ $COUNT -ge $MAX_NICS ]; then
                        break;
                fi
        done
@@ -57,7 +59,7 @@ function create_dhcp_if() {
                echo "BOOTPROTO=dhcp" >> $FILE
                COUNT=$(($COUNT+1))
                # We only want at max two DHCP interfaces.
-               if [ $COUNT -ge 2 ]; then
+               if [ $COUNT -ge $MAX_NICS ]; then
                        break;
                fi
        done
@@ -86,7 +88,7 @@ function create_static_if() {
                echo "NM_CONTROLLED=no" >> $FILE
                COUNT=$(($COUNT+1))
                # We only want at max two interfaces.
-               if [ $COUNT -ge 2 ]; then
+               if [ $COUNT -ge $MAX_NICS ]; then
                        break;
                fi
        done