You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/03/06 19:00:04 UTC
[3/29] git commit: refs/heads/ui-multiple-nics - Summary: Wait for
VPC router nics to hotplug before assigning IPs
Summary: Wait for VPC router nics to hotplug before assigning IPs
Detail: CLOUDSTACK-1452, CLOUDSTACK-1523 - When rebooting VPC routers, ip addr
assignment was inconsistent, sometimes the assignment would be attempted while
router was still setting up nic device. This adds a watch for the nic to show
up before attempting to add an ip to a nic.
Signed-off-by: Marcus Sorensen <ma...@betterservers.com> 1362521453 -0700
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/7dbea68b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/7dbea68b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/7dbea68b
Branch: refs/heads/ui-multiple-nics
Commit: 7dbea68b8728e4b3a5b727a4fd69712cd8a1c468
Parents: 9f180e4
Author: Marcus Sorensen <ma...@betterservers.com>
Authored: Tue Mar 5 15:10:53 2013 -0700
Committer: Marcus Sorensen <ma...@betterservers.com>
Committed: Tue Mar 5 15:10:53 2013 -0700
----------------------------------------------------------------------
.../debian/config/opt/cloud/bin/vpc_guestnw.sh | 12 ++++++++++++
.../debian/config/opt/cloud/bin/vpc_ipassoc.sh | 12 ++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7dbea68b/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh b/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh
index c909cf7..3100345 100755
--- a/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh
+++ b/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh
@@ -129,6 +129,18 @@ desetup_passwdsvcs() {
}
create_guest_network() {
+ # need to wait for eth device to appear before configuring it
+ timer=0
+ while ! `grep -q $dev /proc/net/dev` ; do
+ logger -t cloud "$(basename $0):Waiting for interface $dev to appear, $timer seconds"
+ sleep 1;
+ if [ $timer -gt 15 ]; then
+ logger -t cloud "$(basename $0):interface $dev never appeared"
+ break
+ fi
+ timer=$[timer + 1]
+ done
+
logger -t cloud " $(basename $0): Create network on interface $dev, gateway $gw, network $ip/$mask "
# setup ip configuration
sudo ip addr add dev $dev $ip/$mask brd +
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7dbea68b/patches/systemvm/debian/config/opt/cloud/bin/vpc_ipassoc.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/vpc_ipassoc.sh b/patches/systemvm/debian/config/opt/cloud/bin/vpc_ipassoc.sh
index 53e739d..f2f8a49 100755
--- a/patches/systemvm/debian/config/opt/cloud/bin/vpc_ipassoc.sh
+++ b/patches/systemvm/debian/config/opt/cloud/bin/vpc_ipassoc.sh
@@ -56,6 +56,18 @@ remove_routing() {
}
add_an_ip () {
+ # need to wait for eth device to appear before configuring it
+ timer=0
+ while ! `grep -q $ethDev /proc/net/dev` ; do
+ logger -t cloud "$(basename $0):Waiting for interface $ethDev to appear, $timer seconds"
+ sleep 1;
+ if [ $timer -gt 15 ]; then
+ logger -t cloud "$(basename $0):interface $ethDev never appeared"
+ break
+ fi
+ timer=$[timer + 1]
+ done
+
logger -t cloud "$(basename $0):Adding ip $pubIp on interface $ethDev"
sudo ip link show $ethDev | grep "state DOWN" > /dev/null
local old_state=$?