diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-early-config b/patches/systemvm/debian/config/etc/init.d/cloud-early-config index 39a7b4d966e..799fc08a546 100755 --- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config +++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config @@ -345,6 +345,7 @@ setup_redundant_router() { cp /root/redundant_router/backup.sh.templ $rrouter_bin_path/backup.sh cp /root/redundant_router/fault.sh.templ $rrouter_bin_path/fault.sh cp /root/redundant_router/primary-backup.sh.templ $rrouter_bin_path/primary-backup.sh + cp /root/redundant_router/checkrouter.sh.templ /root/checkrouter.sh sed -i "s/\[ROUTER_ID\]/$NAME/g" /etc/keepalived/keepalived.conf sed -i "s/\[ROUTER_IP\]/$GUEST_GW\/$GUEST_CIDR_SIZE/g" /etc/keepalived/keepalived.conf sed -i "s/\[BOARDCAST\]/$GUEST_BRD/g" /etc/keepalived/keepalived.conf @@ -366,6 +367,7 @@ setup_redundant_router() { sed -i "s/\[RROUTER_LOG\]/$rrouter_log_str/g" $rrouter_bin_path/backup.sh sed -i "s/\[RROUTER_LOG\]/$rrouter_log_str/g" $rrouter_bin_path/fault.sh sed -i "s/\[RROUTER_LOG\]/$rrouter_log_str/g" $rrouter_bin_path/primary-backup.sh + sed -i "s/\[RROUTER_LOG\]/$rrouter_log_str/g" /root/checkrouter.sh chmod a+x $rrouter_bin_path/*.sh sed -i "s/--exec\ \$DAEMON;/--exec\ \$DAEMON\ --\ --vrrp;/g" /etc/init.d/keepalived diff --git a/patches/systemvm/debian/config/root/ipassoc.sh b/patches/systemvm/debian/config/root/ipassoc.sh index fa13a962ab2..b825bc4eef9 100644 --- a/patches/systemvm/debian/config/root/ipassoc.sh +++ b/patches/systemvm/debian/config/root/ipassoc.sh @@ -213,7 +213,7 @@ op="" is_master=0 is_redundant=0 if_keep_state=0 -sudo ls /root/keepalived.log > /dev/null 2>&1 +grep "redundant_router=1" /var/cache/cloud/cmdline > /dev/null if [ $? -eq 0 ] then is_redundant=1 diff --git a/patches/systemvm/debian/config/root/redundant_router/checkrouter.sh.templ b/patches/systemvm/debian/config/root/redundant_router/checkrouter.sh.templ new file mode 100755 index 00000000000..d43c181e2d8 --- /dev/null +++ b/patches/systemvm/debian/config/root/redundant_router/checkrouter.sh.templ @@ -0,0 +1,24 @@ +#!/bin/bash + +source /root/func.sh + +lock="rrouter" +locked=$(getLockFile $lock) +if [ "$locked" != "1" ] +then + exit 1 +fi + +bumped="Bumped: NO" +if [ -e /tmp/rrouter_bumped ] +then + bumped="Bumped: YES" +fi + +stat=`tail -n 1 [RROUTER_LOG] | grep "Status"` +if [ $? -eq 0 ] +then + echo "$stat&$bumped" +fi + +unlock_exit $? $lock $locked