Updated Branches:
  refs/heads/4.1 ba4106305 -> 4d853d7d4

Summary: CLOUDSTACK-1565 - Waits for ip to come up before setting default route

Submitted-by: Jayapal Reddy <[email protected]>
Signed-off-by: Marcus Sorensen <[email protected]> 1364226284 -0600


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

Branch: refs/heads/4.1
Commit: aca6f2879037912229f6c0c3a66ee5750c752b7a
Parents: ba41063
Author: Marcus Sorensen <[email protected]>
Authored: Mon Mar 25 09:44:44 2013 -0600
Committer: Chip Childers <[email protected]>
Committed: Mon Mar 25 17:24:38 2013 +0000

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aca6f287/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 8e9f83a..13b0781 100755
--- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config
+++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
@@ -387,7 +387,28 @@ setup_common() {
       then
           ip route add default via $GW dev eth0
       else
-          ip route add default via $GW dev $3
+         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
       fi
   fi
  

Reply via email to