bug 11307: Add PRIORITY bump up script for redundant virtual routers

This commit is contained in:
Sheng Yang 2011-09-14 02:58:43 -07:00
parent 9191a2fad5
commit 4bbfa2513e
5 changed files with 51 additions and 32 deletions

View File

@ -341,6 +341,7 @@ setup_redundant_router() {
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
sed -i "s/\[PRIORITY\]/$ROUTER_PR/g" /etc/keepalived/keepalived.conf
sed -i "s/\[DELTA\]/2/g" /etc/keepalived/keepalived.conf
sed -i "s/\[LINK_IF\]/eth0/g" /etc/conntrackd/conntrackd.conf
sed -i "s/\[LINK_IP\]/$ETH0_IP/g" /etc/conntrackd/conntrackd.conf
sed -i "s/\[IGNORE_IP1\]/$GUEST_GW/g" /etc/conntrackd/conntrackd.conf

View File

@ -0,0 +1,3 @@
#!/bin/bash
touch /tmp/rrouter_bumped

View File

@ -9,6 +9,16 @@ then
exit 1
fi
tail -n 1 /root/keepalived.log | grep "Status"
bumped="Bumped: NO"
if [ -e /tmp/rrouter_bumped ]
then
bumped="Bumped: YES"
fi
stat=`tail -n 1 /root/keepalived.log | grep "Status"`
if [ $? -eq 0 ]
then
echo "$stat&$bumped"
fi
unlock_exit $? $lock $locked

View File

@ -0,0 +1,3 @@
#!/bin/bash
cat /tmp/rrouter_bumped

View File

@ -4,38 +4,12 @@ global_defs {
router_id [ROUTER_ID]
}
vrrp_sync_group VG_1 {
group {
inside_network # name of vrrp_instance (below)
outside_network # One for each moveable IP.
}
# notify scripts and alerts are optional
#
# filenames of scripts to run on transitions
# can be unquoted (if just filename)
# or quoted (if has parameters)
# to MASTER transition
notify_master "/root/redundant_router/master.sh"
# to BACKUP transition
notify_backup "/root/redundant_router/backup.sh"
# FAULT transition
notify_fault "/root/redundant_router/fault.sh"
# for ANY state transition.
# "notify" script is called AFTER the
# notify_* script(s) and is executed
# with 3 arguments provided by keepalived
# (ie don't include parameters in the notify line).
# arguments
# $1 = "GROUP"|"INSTANCE"
# $2 = name of group or instance
# $3 = target state of transition
# ("MASTER"|"BACKUP"|"FAULT")
#notify /root/redundant_router/notify.sh
vrrp_script check_bumpup {
script "/root/redundant_router/check_bumpup.sh"
interval 5
weight [DELTA]
}
vrrp_instance inside_network {
state BACKUP
interface eth0
@ -52,5 +26,33 @@ vrrp_instance inside_network {
[ROUTER_IP] brd [BOARDCAST] dev eth0
}
nopreempt
track_script {
check_bumpup
}
#nopreempt
# notify scripts and alerts are optional
#
# filenames of scripts to run on transitions
# can be unquoted (if just filename)
# or quoted (if has parameters)
# to MASTER transition
notify_master "/root/redundant_router/master.sh"
# to BACKUP transition
notify_backup "/root/redundant_router/backup.sh"
# FAULT transition
notify_fault "/root/redundant_router/fault.sh"
# for ANY state transition.
# "notify" script is called AFTER the
# notify_* script(s) and is executed
# with 3 arguments provided by keepalived
# (ie don't include parameters in the notify line).
# arguments
# $1 = "GROUP"|"INSTANCE"
# $2 = name of group or instance
# $3 = target state of transition
# ("MASTER"|"BACKUP"|"FAULT")
#notify /root/redundant_router/notify.sh
}