You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/04/21 19:03:33 UTC
[22/49] git commit: updated refs/heads/marvin_refactor to 0b5fe9a
CLOUDSTACK-2118 added delay for interface to come up in cloud-early-config In cloud-early-config ifup is taking some time to setup the interface ip So in setup_interface waiting for some time for interface to come up
Signed-off-by: Abhinandan Prateek <ap...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/59bee8d1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/59bee8d1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/59bee8d1
Branch: refs/heads/marvin_refactor
Commit: 59bee8d1b4d1ffff3e7e4a00788dfcd1d8eafa2a
Parents: b01f631
Author: Jayapal <ja...@citrix.com>
Authored: Fri Apr 19 17:31:19 2013 +0530
Committer: Abhinandan Prateek <ap...@apache.org>
Committed: Fri Apr 19 17:43:36 2013 +0530
----------------------------------------------------------------------
.../debian/config/etc/init.d/cloud-early-config | 53 +++++++--------
1 files changed, 26 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/59bee8d1/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 3faa1bd..b8ddaf1 100755
--- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config
+++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
@@ -27,6 +27,8 @@
# under the License.
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
+#set -x
+#exec 3>&0 4>&1 > /var/log/test.log 2>&1
# Fix haproxy directory issue
mkdir -p /var/lib/haproxy
@@ -227,7 +229,29 @@ setup_interface() {
ifdown $intf
if [ "$RROUTER" != "1" -o "$1" != "2" ]
then
- ifup $intf
+ ifup $intf
+ timer=0
+ log_it "checking that $intf has IP "
+ while true
+ do
+ ip=$(ifconfig $intf | grep "inet addr:" | awk '{print $2}' | awk -F: '{print $2}')
+ if [ -z $ip ]
+ then
+ sleep 1;
+ #waiting for the interface to setup with ip
+ log_it "waiting for $intf interface setup with ip timer=$timer"
+ else
+ break
+ fi
+
+ if [ $timer -gt 15 ]
+ then
+ log_it "interface $intf is not set up with ip... exiting";
+ break
+ fi
+
+ timer=`expr $timer + 1`
+ done
fi
fi
}
@@ -392,33 +416,8 @@ setup_common() {
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
- 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
- ip route add default via $GW dev $gwdev
- break
- fi
+ ip route add default via $GW dev $gwdev
- 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