Updated Branches:
  refs/heads/master a4a059c04 -> 9670553ea

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 <mar...@betterservers.com> 1365617851 -0600


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

Branch: refs/heads/master
Commit: 9670553ea85d6593046425f2c040cc08d2e61733
Parents: a4a059c
Author: Marcus Sorensen <mar...@betterservers.com>
Authored: Wed Apr 10 12:17:31 2013 -0600
Committer: Marcus Sorensen <mar...@betterservers.com>
Committed: Wed Apr 10 12:17:31 2013 -0600

----------------------------------------------------------------------
 .../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/9670553e/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 514c0b0..3faa1bd 100755
--- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config
+++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
@@ -386,33 +386,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