You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ja...@apache.org on 2014/07/01 11:48:48 UTC

[2/2] git commit: updated refs/heads/4.4-forward to e336796

CLOUDSTACK-7028: Fixed adding route for additional public nic on fail over


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e336796c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e336796c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e336796c

Branch: refs/heads/4.4-forward
Commit: e336796cd5eae39bf7755d981426160a15bc6e9f
Parents: a69c1ee
Author: Jayapal <ja...@apache.org>
Authored: Tue Jul 1 13:46:44 2014 +0530
Committer: Jayapal <ja...@apache.org>
Committed: Tue Jul 1 15:16:07 2014 +0530

----------------------------------------------------------------------
 .../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/e336796c/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/e336796c/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/e336796c/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