Repository: cloudstack Updated Branches: refs/heads/4.4 9d7a83239 -> 09022344e
CLOUDSTACK-7028: Fixed adding route for additional public nic on fail over (cherry picked from commit e336796cd5eae39bf7755d981426160a15bc6e9f) Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d5a92454 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d5a92454 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d5a92454 Branch: refs/heads/4.4 Commit: d5a92454fd53c49eed38623635dd504c0537e7ea Parents: 9d7a832 Author: Jayapal <[email protected]> Authored: Tue Jul 1 13:46:44 2014 +0530 Committer: Daan Hoogland <[email protected]> Committed: Tue Jul 1 14:36:27 2014 +0200 ---------------------------------------------------------------------- .../debian/config/etc/init.d/cloud-early-config | 3 +++ .../patches/debian/config/opt/cloud/bin/ipassoc.sh | 7 +++++++ .../config/root/redundant_router/enable_pubip.sh.templ | 13 +++++++++++++ 3 files changed, 23 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d5a92454/systemvm/patches/debian/config/etc/init.d/cloud-early-config ---------------------------------------------------------------------- diff --git a/systemvm/patches/debian/config/etc/init.d/cloud-early-config b/systemvm/patches/debian/config/etc/init.d/cloud-early-config index 938e6f8..bbf1998 100755 --- a/systemvm/patches/debian/config/etc/init.d/cloud-early-config +++ b/systemvm/patches/debian/config/etc/init.d/cloud-early-config @@ -892,6 +892,9 @@ setup_aesni() { setup_router() { log_it "Setting up virtual router system vm" + #To save router public interface and gw ip information + touch /var/cache/cloud/ifaceGwIp + oldmd5= [ -f "/etc/udev/rules.d/70-persistent-net.rules" ] && oldmd5=$(md5sum "/etc/udev/rules.d/70-persistent-net.rules" | awk '{print $1}') http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d5a92454/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 2a9d780..50f6b4d 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/ipassoc.sh +++ b/systemvm/patches/debian/config/opt/cloud/bin/ipassoc.sh @@ -230,6 +230,11 @@ add_first_ip() { sudo arping -c 1 -I $ethDev -A -U -s $ipNoMask $ipNoMask; sudo arping -c 1 -I $ethDev -A -U -s $ipNoMask $ipNoMask; fi + + # add interface gateway ip info into file, used on redundant router fail over for adding routes + sed -i /"$ethDev "/d $IFACEGWIPFILE + echo "$ethDev $defaultGwIP" >> $IFACEGWIPFILE + add_routing $1 return 0 @@ -257,6 +262,7 @@ remove_first_ip() { sudo ip link set $ethDev down return 1 fi + sed -i /"$ethDev "/d $IFACEGWIPFILE remove_routing $1 sudo ip link set $ethDev down return $? @@ -344,6 +350,7 @@ op="" is_master=0 is_redundant=0 if_keep_state=0 +IFACEGWIPFILE='/var/cache/cloud/ifaceGwIp' grep "redundant_router=1" /var/cache/cloud/cmdline > /dev/null if [ $? -eq 0 ] then http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d5a92454/systemvm/patches/debian/config/root/redundant_router/enable_pubip.sh.templ ---------------------------------------------------------------------- diff --git a/systemvm/patches/debian/config/root/redundant_router/enable_pubip.sh.templ b/systemvm/patches/debian/config/root/redundant_router/enable_pubip.sh.templ index 0e2d03a..a59cd66 100644 --- a/systemvm/patches/debian/config/root/redundant_router/enable_pubip.sh.templ +++ b/systemvm/patches/debian/config/root/redundant_router/enable_pubip.sh.templ @@ -35,3 +35,16 @@ do fi done < /tmp/iflist ip route add default via [GATEWAY] dev eth2 + +while read line +do +dev=$(echo $line | awk '{print $1'}) +gw=$(echo $line | awk '{print $2'}) + +if [ "$dev" == "eth2" ] +then + continue; +fi +ip route add default via $gw table Table_$dev proto static + +done < /var/cache/cloud/ifaceGwIp
