wilderrodrigues 20be22c698 CLOUDSTACK-8616 - Removing the Priority form KeepaliveD configuration
- We use no preempt mode with state set as EQUAL to both nodes, no need to have Priotities setup
   - Do not add IPs as comments to the configuration. If a new guest interface is added, the file will change anyway.
     - This was used in the past when keepalived would restart for each new interface added
   - Removed the long sleep form the tests: we now sleep 5 seconds per PF rule added

CLOUDSTACK-8616 - Fix keepalived.ts/2 files comparison

   - Add call to set_fault() in case of router transits to that state
   - Removing commented out code

CLOUDSTACK-8616 - Fixing check_heartbeat.sh.templ

CLOUDSTACK-8616 - Call set_fault from the check_heartbeat.sh script

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-07-16 13:14:48 +02:00

64 lines
2.1 KiB
Plaintext
Executable File

#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
ROUTER_BIN_PATH=/ramdisk/rrouter
ROUTER_LOG=${ROUTER_BIN_PATH}/keepalived.log
STRIKE_FILE="$ROUTER_BIN_PATH/keepalived.strikes"
if [ -e $ROUTER_BIN_PATH/keepalived.ts2 ]
then
thistime=$(cat $ROUTER_BIN_PATH/keepalived.ts)
lasttime=$(cat $ROUTER_BIN_PATH/keepalived.ts2)
diff=$(($lasttime - $thistime))
s=0
if [ $diff -ge 10 ]
then
if [ -e $STRIKE_FILE ]
then
s=`cat $STRIKE_FILE 2>/dev/null`
fi
s=$(($s+1))
echo $s > $STRIKE_FILE
else
if [ -e $STRIKE_FILE ]
then
rm $STRIKE_FILE
echo keepalived.strikes file was removed! >> $ROUTER_LOG
else
echo keepalived.strikes file does not exist! >> $ROUTER_LOG
fi
fi
#3 strikes rule
if [ $s -gt 2 ]
then
echo Keepalived process is dead! >> $ROUTER_LOG
service keepalived stop >> $ROUTER_LOG 2>&1
service conntrackd stop >> $ROUTER_LOG 2>&1
#Set fault so we have the same effect as a KeepaliveD fault.
python /opt/cloud/bin/master.py --fault
pkill -9 keepalived >> $ROUTER_LOG 2>&1
pkill -9 conntrackd >> $ROUTER_LOG 2>&1
echo Status: FAULT \(keepalived process is dead\) >> $ROUTER_LOG
exit
fi
fi
cp $ROUTER_BIN_PATH/keepalived.ts $ROUTER_BIN_PATH/keepalived.ts2