Updated Branches:
  refs/heads/4.1 3bf8ca769 -> 625eb3c49

In system vm, wait for interface to be available before configuring gateway.
Previous patch to this only did so for system vms with a $3 interface, usually
eth2. System VMs that only provide DNS wouldn't get a gateway, for example.

BUG-ID: CLOUDSTACK-1565
Signed-off-by: Marcus Sorensen <[email protected]> 1365617851 -0600


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/625eb3c4
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/625eb3c4
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/625eb3c4

Branch: refs/heads/4.1
Commit: 625eb3c490968599f99bfd325db60c8d3050c7de
Parents: 3bf8ca7
Author: Marcus Sorensen <[email protected]>
Authored: Wed Apr 10 12:17:31 2013 -0600
Committer: Chip Childers <[email protected]>
Committed: Thu Apr 11 18:36:22 2013 +0100

----------------------------------------------------------------------
 .../debian/config/etc/init.d/cloud-early-config    |   54 ++++++++-------
 1 files changed, 30 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/625eb3c4/patches/systemvm/debian/config/etc/init.d/cloud-early-config
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-early-config 
b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
index 25bb8b1..d80c63d 100755
--- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config
+++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
@@ -383,33 +383,39 @@ setup_common() {
   ip route delete default
   if [ "$RROUTER" != "1" ]
   then
-      if [ -z "$3" ]
+    gwdev=$3
+    if [ -z "$gwdev" ]
+    then
+      gwdev="eth0"
+    fi
+
+    timer=0
+    #default route add fails if we run before interface configured with ip
+    log_it "checking that $gwdev has IP before setting default route to $GW"
+    echo "checking that $gwdev has IP before setting default route to $GW"
+    while true
+    do
+      ip=$(ifconfig $gwdev | grep "inet addr:" | awk '{print $2}' | awk -F: 
'{print $2}')
+      if [ -z $ip ] 
       then
-          ip route add default via $GW dev eth0
+             sleep 1;
+             #waiting for the interface to setup with ip
+              log_it "waiting for $gwdev interface setup with ip"
+             echo "waiting for $gwdev interface setup with ip"
       else
-         timer=0
-         #default route add fails if we run before interface configured with ip
-         while true
-         do
-             ip=$(ifconfig $3 | grep "inet addr:" | awk '{print $2}' | awk -F: 
'{print $2}')
-             if [ -z $ip ] 
-             then
-                     sleep 1;
-                     #waiting for the interface to setup with ip
-                     echo "waiting for $3 interface setup with ip"
-             else
-                     ip route add default via $GW dev $3
-                     break
-             fi
-             
-             if [ $timer -gt 5 ] 
-             then
-                 echo "interface $3 is not set up with ip... configuring 
default route failed"
-                 break
-         fi
-         timer=`expr $timer + 1`
-        done
+              ip route add default via $GW dev $gwdev
+             break
       fi
+
+      if [ $timer -gt 15 ] 
+      then
+          log_it  "interface $gwdev is not set up with ip... configuring 
default route failed";
+          echo "interface $gwdev is not set up with ip... configuring default 
route failed"
+         break
+      fi
+      timer=`expr $timer + 1`
+    done
+      
   fi
  
   # a hacking way to activate vSwitch under VMware

Reply via email to