integ/utilities/pci-irq-affinity-agent/files/pci-irq-affinity-agent
zhipengl ce0cc60346 Fix for pci-irq-affinity-agent failing to start in AIO
Ensure that pci-irq-affinity-agent is launched on worker nodes.
This includes AIO and standard configs.

Root cause is in this agent start script, it can be started
only if node type is worker. But for AIO, the node type is controller.
Then pmon will restart it again and again and cause controller degrade
in the end.

Below test for AIO pass
1) Pci-irq-affinity-agent started normally before openstack apply.
After openstack apply, related openstack config applied to
agent config file as expected.
2) Verified agent started normally in non-openstack worker node for
both AIO and multi-node.
No degrade in controller node.

Change-Id: I73e9dff0358b7ed86bfaaadac834e19fe227892f
Closes-Bug: #1828877
Signed-off-by: zhipengl <zhipengs.liu@intel.com>
2019-05-15 09:14:46 +00:00

106 lines
2.5 KiB
Bash
Executable File

#! /bin/sh
#
# Copyright (c) 2019 StarlingX.
#
# SPDX-License-Identifier: Apache-2.0
#
#
# chkconfig: 2345 75 25
#
### BEGIN INIT INFO
# Provides: pci-irq-affinity-agent
### END INIT INFO
source /etc/init.d/functions
DAEMON_NAME="pci-irq-affinity-agent"
AFFINITYAGENT="/usr/bin/${DAEMON_NAME}"
daemon_pidfile="/var/run/${DAEMON_NAME}.pid"
if [ ! -f "${AFFINITYAGENT}" ] ; then
logger "$0: ${AFFINITYAGENT} is missing"
exit 1
fi
RETVAL=0
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
export PATH
case "$1" in
start)
# Check for installation failure
if [ -f /etc/platform/installation_failed ] ; then
logger "$0: /etc/platform/installation_failed flag is set. Aborting."
exit 1
fi
echo -n "Setting up config for pci-irq-affinity-agent: "
if [ -e ${daemon_pidfile} ] ; then
echo "Killing existing process before starting new"
pid=`cat ${daemon_pidfile}`
kill -TERM $pid
rm -f ${daemon_pidfile}
fi
echo -n "Starting pci-irq-affinity-agent: "
/bin/sh -c "${AFFINITYAGENT}"' >> /dev/null 2>&1 & echo $!' > ${daemon_pidfile}
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
echo "OK"
touch /var/lock/subsys/${DAEMON_NAME}
else
echo "FAIL"
fi
;;
stop)
echo -n "Stopping pci-irq-affinity-agent: "
if [ -e ${daemon_pidfile} ] ; then
pid=`cat ${daemon_pidfile}`
kill -TERM $pid
rm -f ${daemon_pidfile}
rm -f /var/lock/subsys/${DAEMON_NAME}
echo "OK"
else
echo "FAIL"
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
if [ -e ${daemon_pidfile} ] ; then
pid=`cat ${daemon_pidfile}`
ps -p $pid | grep -v "PID TTY" >> /dev/null 2>&1
if [ $? -eq 0 ] ; then
echo "pci-irq-affinity-agent is running"
RETVAL=0
else
echo "pci-irq-affinity-agent is not running"
RETVAL=1
fi
else
echo "pci-irq-affinity-agent is not running ; no pidfile"
RETVAL=1
fi
;;
condrestart)
[ -f /var/lock/subsys/$DAEMON_NAME ] && $0 restart
;;
*)
echo "usage: $0 { start | stop | status | restart | condrestart | status }"
;;
esac
exit $RETVAL