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/8eb3ebbe Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8eb3ebbe Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8eb3ebbe Branch: refs/heads/scaleupvm Commit: 8eb3ebbe1abc6b33b28c58ff3cd4090dd78da58b Parents: 74bd7d5 Author: Marcus Sorensen <[email protected]> Authored: Mon Mar 25 09:44:44 2013 -0600 Committer: Marcus Sorensen <[email protected]> Committed: Mon Mar 25 09:46:47 2013 -0600 ---------------------------------------------------------------------- .../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/8eb3ebbe/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 1f0b9a7..2b99c5b 100755 --- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config +++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config @@ -390,7 +390,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
