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

(cherry picked from commit e336796cd5)
This commit is contained in:
Jayapal 2014-07-01 13:46:44 +05:30 committed by Daan Hoogland
parent 9d7a832395
commit d5a92454fd
3 changed files with 23 additions and 0 deletions

View File

@ -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}')

View File

@ -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

View File

@ -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