Skip to content

Commit 02bafe8

Browse files
committed
Apply Wei's patch to test failures
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 1629789 commit 02bafe8

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

systemvm/debian/opt/cloud/templates/check_heartbeat.sh.templ

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,35 @@
1919
ROUTER_BIN_PATH=/ramdisk/rrouter
2020
ROUTER_LOG=${ROUTER_BIN_PATH}/keepalived.log
2121
STRIKE_FILE="$ROUTER_BIN_PATH/keepalived.strikes"
22+
CHECKTIME_FILE="$ROUTER_BIN_PATH/keepalived.checktime"
2223

2324
if [ -e $ROUTER_BIN_PATH/keepalived.ts2 ]
2425
then
2526
thistime=$(cat $ROUTER_BIN_PATH/keepalived.ts)
2627
lasttime=$(cat $ROUTER_BIN_PATH/keepalived.ts2)
2728
diff=$(($thistime - $lasttime))
29+
lastcheck=0
30+
if [ -e $CHECKTIME_FILE ]
31+
then
32+
lastcheck=`cat $CHECKTIME_FILE 2>/dev/null`
33+
fi
34+
thischeck=$(date +%s)
35+
checkdiff=$(($thischeck - $lastcheck))
36+
echo "thischeck: $thischeck, lastcheck: $lastcheck. this heartbeat: $thistime, last heartbeat: $lasttime, time diff: $diff" >> $ROUTER_LOG
37+
if [ $checkdiff -ge 0 ] && [ $checkdiff -lt 30 ]
38+
then
39+
echo time duration after last check is less than 30 seconds, ignored >> $ROUTER_LOG
40+
exit
41+
fi
42+
echo $thischeck > $CHECKTIME_FILE
2843
s=0
29-
if [ $diff -ge 10 ]
44+
if [ $diff -ge 30 ]
3045
then
3146
if [ -e $STRIKE_FILE ]
3247
then
3348
s=`cat $STRIKE_FILE 2>/dev/null`
3449
fi
35-
s=$(($s + 1))
50+
s=$(($s+1))
3651
echo $s > $STRIKE_FILE
3752
else
3853
if [ -e $STRIKE_FILE ]

0 commit comments

Comments
 (0)