]> xenbits.xensource.com Git - xentesttools/bootstrap.git/commitdiff
network-startup: Bring up only DHCP up to two interfaces - switch and ethX..
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tue, 24 Jan 2012 04:10:32 +0000 (23:10 -0500)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 25 Jan 2012 03:04:43 +0000 (22:04 -0500)
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
root_image/etc/init.d/primary_network

index 5fe282da63720267339970b002d9b59215f7c5b6..8f2a057cc666b642b212289a7df061c4934d3258 100755 (executable)
@@ -16,6 +16,7 @@ echo "DEVICE=$NIC" > $FILE
 echo "ONBOOT=yes" >> $FILE
 echo "BRIDGE=switch" >> $FILE
 
+COUNT=0
 NICS=`ls -1 /sys/class/net/ | grep -v lo | grep -v sit`
 # The rest
 for NIC in $NICS
@@ -26,7 +27,12 @@ do
        FILE=/etc/sysconfig/network-scripts/ifcfg-$NIC
        echo "DEVICE=$NIC" > $FILE
        echo "ONBOOT=yes" >> $FILE
-       echo "BOOTPROTO=dhcp" >> $FILE  
+       echo "BOOTPROTO=dhcp" >> $FILE
+       COUNT=$(($COUNT+1))
+       # We only want at max two DHCP interfaces.
+       if [ $COUNT -ge 1 ]; then
+               break;
+       fi
 done
 
 /etc/init.d/network start