You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ke...@apache.org on 2012/05/28 00:35:42 UTC
[44/50] [abbrv] git commit: CS-14784, CS-15065 , after release IP,
reapply other IPs in the same eth device,
to prevent secondary IPs are removed when primary IP is removed
CS-14784, CS-15065 , after release IP, reapply other IPs in the same eth device, to prevent secondary IPs are removed when primary IP is removed
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/b650fef1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/b650fef1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/b650fef1
Branch: refs/heads/3.0.x
Commit: b650fef1e0c383d7ca370071b14634ae36469033
Parents: 4a18385
Author: anthony <an...@cloud.com>
Authored: Wed May 23 18:42:53 2012 -0700
Committer: anthony <an...@cloud.com>
Committed: Wed May 23 18:45:49 2012 -0700
----------------------------------------------------------------------
patches/systemvm/debian/config/root/ipassoc.sh | 29 ++++++++----------
1 files changed, 13 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b650fef1/patches/systemvm/debian/config/root/ipassoc.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/root/ipassoc.sh b/patches/systemvm/debian/config/root/ipassoc.sh
index 7087e7f..cfaa46f 100644
--- a/patches/systemvm/debian/config/root/ipassoc.sh
+++ b/patches/systemvm/debian/config/root/ipassoc.sh
@@ -135,12 +135,7 @@ copy_routes_from_main() {
ip_addr_add() {
local dev="$1"
local ip="$2"
- local ipNoMask=$(echo $ip | awk -F'/' '{print $1}')
- local mask=$(echo $ip | awk -F'/' '{print $2}')
- local subnet=`TERM=linux ipcalc $ip | grep Network | awk -F' ' '{print $2}' | awk -F'/' '{print $1}'`
- local brd=`TERM=linux ipcalc $ip|grep Broadcast|awk -F' ' '{print $2}'`
- sudo ip addr add dev $dev $subnet/$mask broadcast $brd > /dev/null
- sudo ip addr add dev $dev $ipNoMask/32
+ sudo ip addr add dev $dev $ip > /dev/null
}
@@ -286,18 +281,20 @@ add_an_ip () {
remove_an_ip () {
local pubIp=$1
logger -t cloud "$(basename $0):Removing ip $pubIp on interface $ethDev"
- local ipNoMask=$(echo $1 | awk -F'/' '{print $1}')
- local mask=$(echo $1 | awk -F'/' '{print $2}')
- local existingIpMask=$(sudo ip addr show dev $ethDev | grep inet | awk '{print $2}' | grep -w $ipNoMask)
- [ "$existingIpMask" == "" ] && return 0
remove_snat $1
- sudo ip addr del dev $ethDev $existingIpMask
+ local existingIpMask=$(sudo ip addr show dev $ethDev | grep "inet " | awk '{print $2}')
+
+ sudo ip addr del dev $ethDev $pubIp
+
+ for ipMask in $existingIpMask
+ do
+ if [ "$ipMask" == "$pubIp" ]
+ then
+ continue
+ fi
+ sudo ip addr add dev $ethDev $ipMask
+ done
- if [ $result -gt 0 -a $result -ne 2 ]
- then
- remove_routing $1
- return 1
- fi
remove_routing $1
return 0
}