Skip to content

Commit

Permalink
Connections to the standby instance of HAP should not be created. Fix…
Browse files Browse the repository at this point in the history
… provides a way to check for this and restart HAP with the intention that apps will reconnect to the right HAP instance

Closes-Bug: #1581905

Change-Id: I39529ac7c789bf45e896b96c5feebe9f74d6d374
  • Loading branch information
sanju-a committed May 25, 2016
1 parent 489f20e commit e4cd10a
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions contrail_provisioning/openstack/scripts/contrail-cmon-monitor.sh
Expand Up @@ -166,11 +166,9 @@ verify_cmon() {
cmon=$CMON_SVC_CHECK
cmonpid=$(pidof cmon)
if [ $cmon == $cmonpid ] && [ -n "$cmonpid" ]; then
log_info_msg "CMON is Running"
echo "y"
return 1
else
log_info_msg "CMON is not Running"
echo "n"
return 0
fi
Expand Down Expand Up @@ -286,37 +284,43 @@ if [ $viponme == 0 ]; then
hapid=$(pidof haproxy)
for (( i=0; i<${DIPS_SIZE}; i++ ))
do
dipsonnonvip=$(lsof -p $hapid | grep ${DIPS[i]} | awk '{print $9}')
if [[ -n "$dipsonnonvip" ]]; then
dipsonnonvip=$(lsof -p $hapid | grep ${DIPS[i]} | awk '{print $9}' | wc -l)
if [[ $dipsonnonvip -ne 0 ]] && [[ -n "$dipsonnonvip" ]]; then
dipsonvipdumpip=$(lsof -p $hapid | grep ${DIPS[i]} | awk '{print $9}')
haprestart=1
break
fi
done

for (( i=0; i<${DIPS_HOST_SIZE}; i++ ))
do
dipsonnonvip=$(lsof -p $hapid | grep ${DIPHOSTS[i]} | awk '{print $9}')
if [[ -n "$dipsonnonvip" ]]; then
dipsonnonvip=$(lsof -p $hapid | grep ${DIPHOSTS[i]} | awk '{print $9}' | wc -l)
if [[ $dipsonnonvip -ne 0 ]] && [[ -n "$dipsonnonvip" ]]; then
dipsonvipdumphosts=$(lsof -p $hapid | grep ${DIPHOSTS[i]} | awk '{print $9}')
haprestart=1
break
fi
done

if [ $haprestart -eq 1 ]; then
(exec $HAP_RESTART)&
log_info_msg "Restarted HAP becuase of stale dips"
log_error_msg "connections to backends from this HAP instance:"
log_error_msg "$dipsonvipdumpip"
log_error_msg "$dipsonvipdumphosts"
#(exec $HAP_RESTART)&
#log_info_msg "Restarted HAP becuase of stale dips"
fi
fi

if [ -f $cleanuppending ]; then
(exec rm -rf $cleanuppending)&
fi
if [ -f $rstcnt ]; then
(exec rm -rf $rstcnt)&
fi
if [ -f $numrst ]; then
(exec rm -rf $numrst)&
fi
# These are handled in RMQ monitoring
#if [ -f $rstcnt ]; then
# (exec rm -rf $rstcnt)&
#fi
#if [ -f $numrst ]; then
# (exec rm -rf $numrst)&
#fi
}

cleanup() {
Expand Down

0 comments on commit e4cd10a

Please sign in to comment.