
Use openstack-panko-config package to package config file for openstack-panko package. The StarlingX common logrotate config file includes panko log files. To avoid conflict with the logrotate config file from openstack-panko, we're overwriting this file with just a comment to clear its config. Deployment test pass and config file check pass! Story: 2003768 Task: 28362 Change-Id: I09b0f6ae93b915e10ff3d8cdf6fc9cbd5fe9426e Signed-off-by: zhipengl <zhipengs.liu@intel.com>
61 lines
1.7 KiB
Bash
61 lines
1.7 KiB
Bash
#!/bin/bash
|
|
|
|
#
|
|
# Wrapper script to run panko-expirer when on active controller only
|
|
#
|
|
PANKO_EXPIRER_INFO="/var/run/panko-expirer.info"
|
|
PANKO_EXPIRER_CMD="/usr/bin/nice -n 2 /usr/bin/panko-expirer"
|
|
|
|
function is_active_pgserver()
|
|
{
|
|
# Determine whether we're running on the same controller as the service.
|
|
local service=postgres
|
|
local enabledactive=$(/usr/bin/sm-query service $service| grep enabled-active)
|
|
if [ "x$enabledactive" == "x" ]
|
|
then
|
|
# enabled-active not found for that service on this controller
|
|
return 1
|
|
else
|
|
# enabled-active found for that resource
|
|
return 0
|
|
fi
|
|
}
|
|
|
|
if is_active_pgserver
|
|
then
|
|
if [ ! -f ${PANKO_EXPIRER_INFO} ]
|
|
then
|
|
echo skip_count=0 > ${PANKO_EXPIRER_INFO}
|
|
fi
|
|
|
|
source ${PANKO_EXPIRER_INFO}
|
|
sudo -u postgres psql -d sysinv -c "SELECT alarm_id, entity_instance_id from i_alarm;" | grep -P "^(?=.*100.101)(?=.*${HOSTNAME})" &>/dev/null
|
|
if [ $? -eq 0 ]
|
|
then
|
|
source /etc/platform/platform.conf
|
|
if [ "${system_type}" = "All-in-one" ]
|
|
then
|
|
source /etc/init.d/task_affinity_functions.sh
|
|
idle_core=$(get_most_idle_core)
|
|
if [ "$idle_core" -ne "0" ]
|
|
then
|
|
sh -c "exec taskset -c $idle_core ${PANKO_EXPIRER_CMD}"
|
|
sed -i "/skip_count/s/=.*/=0/" ${PANKO_EXPIRER_INFO}
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
if [ "$skip_count" -lt "3" ]
|
|
then
|
|
newval=$(($skip_count+1))
|
|
sed -i "/skip_count/s/=.*/=$newval/" ${PANKO_EXPIRER_INFO}
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
eval ${PANKO_EXPIRER_CMD}
|
|
sed -i "/skip_count/s/=.*/=0/" ${PANKO_EXPIRER_INFO}
|
|
fi
|
|
|
|
exit 0
|