CLOUDSTACK-7544: Fixed ip addr del issues in ipassoc
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3cb6d4a4 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3cb6d4a4 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3cb6d4a4 Branch: refs/heads/master Commit: 3cb6d4a4dffc317603def7147bfeef7340c33a93 Parents: f0e82f3 Author: Jayapal <[email protected]> Authored: Thu Sep 11 17:09:56 2014 +0530 Committer: Jayapal <[email protected]> Committed: Mon Sep 15 14:54:13 2014 +0530 ---------------------------------------------------------------------- .../patches/debian/config/opt/cloud/bin/deleteIpAlias.sh | 2 +- systemvm/patches/debian/config/opt/cloud/bin/ipassoc.sh | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cb6d4a4/systemvm/patches/debian/config/opt/cloud/bin/deleteIpAlias.sh ---------------------------------------------------------------------- diff --git a/systemvm/patches/debian/config/opt/cloud/bin/deleteIpAlias.sh b/systemvm/patches/debian/config/opt/cloud/bin/deleteIpAlias.sh index 47edb92..8b14919 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/deleteIpAlias.sh +++ b/systemvm/patches/debian/config/opt/cloud/bin/deleteIpAlias.sh @@ -56,5 +56,5 @@ service apache2 restart releaseLockFile $lock $locked #recreating the active ip aliases -/root/createIpAlias.sh $2 +/opt/cloud/bin/createIpAlias.sh $2 unlock_exit $? $lock $locked \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cb6d4a4/systemvm/patches/debian/config/opt/cloud/bin/ipassoc.sh ---------------------------------------------------------------------- diff --git a/systemvm/patches/debian/config/opt/cloud/bin/ipassoc.sh b/systemvm/patches/debian/config/opt/cloud/bin/ipassoc.sh index 50f6b4d..ad50d4e 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/ipassoc.sh +++ b/systemvm/patches/debian/config/opt/cloud/bin/ipassoc.sh @@ -197,6 +197,7 @@ remove_snat() { fi local pubIp=$1 + local ipNoMask=$(echo $1 | awk -F'/' '{print $1}') logger -t cloud "$(basename $0):Removing SourceNAT $pubIp on interface $ethDev" sudo iptables -t nat -D POSTROUTING -j SNAT -o $ethDev --to-source $ipNoMask; return $? @@ -262,6 +263,16 @@ remove_first_ip() { sudo ip link set $ethDev down return 1 fi + + for ipMask in $existingIpMask + do + if [ "$ipMask" == "$pubIp" ] + then + continue + fi + sudo ip addr add dev $ethDev $ipMask brd + + done + sed -i /"$ethDev "/d $IFACEGWIPFILE remove_routing $1 sudo ip link set $ethDev down
