[teamd]: Send USR1/USR2 only to subscribers. (#8856)

To fix teamd signal handling, without which Process 'tlm_teamd' exited unexpectedly
This commit is contained in:
Nazarii Hnydyn 2021-10-26 19:12:07 +03:00 committed by Judy Joseph
parent badce1cbf6
commit 5b74f5dccf

View File

@ -5,7 +5,7 @@
function debug() function debug()
{ {
/usr/bin/logger $1 /usr/bin/logger $1
/bin/echo `date` "- $1" >> ${DEBUGLOG} /bin/echo `date` "- $1" >> ${DEBUG_LOG}
} }
function check_warm_boot() function check_warm_boot()
@ -87,13 +87,13 @@ stop() {
# Send USR1 signal to all teamd instances to stop them # Send USR1 signal to all teamd instances to stop them
# It will prepare teamd for warm-reboot # It will prepare teamd for warm-reboot
# Note: We must send USR1 signal before syncd, because it will send the last packet through CPU port # Note: We must send USR1 signal before syncd, because it will send the last packet through CPU port
docker exec -i ${SERVICE}$DEV pkill -USR1 ${SERVICE} > /dev/null || [ $? == 1 ] docker exec -i ${SERVICE}$DEV pkill -USR1 -f ${TEAMD_CMD} > /dev/null || [ $? == 1 ]
elif [[ x"$FAST_BOOT" == x"true" ]]; then elif [[ x"$FAST_BOOT" == x"true" ]]; then
# Kill teamd processes inside of teamd container with SIGUSR2 to allow them to send last LACP frames # Kill teamd processes inside of teamd container with SIGUSR2 to allow them to send last LACP frames
# We call `docker kill teamd` to ensure the container stops as quickly as possible, # We call `docker kill teamd` to ensure the container stops as quickly as possible,
# Note: teamd must be killed before syncd, because it will send the last packet through CPU port # Note: teamd must be killed before syncd, because it will send the last packet through CPU port
docker exec -i ${SERVICE}$DEV pkill -USR2 ${SERVICE} || [ $? == 1 ] docker exec -i ${SERVICE}$DEV pkill -USR2 -f ${TEAMD_CMD} || [ $? == 1 ]
while docker exec -i ${SERVICE}$DEV pgrep ${SERVICE} > /dev/null; do while docker exec -i ${SERVICE}$DEV pgrep -f ${TEAMD_CMD} > /dev/null; do
sleep 0.05 sleep 0.05
done done
docker kill ${SERVICE}$DEV &> /dev/null || debug "Docker ${SERVICE}$DEV is not running ($?) ..." docker kill ${SERVICE}$DEV &> /dev/null || debug "Docker ${SERVICE}$DEV is not running ($?) ..."
@ -106,7 +106,8 @@ stop() {
DEV=$2 DEV=$2
SERVICE="teamd" SERVICE="teamd"
DEBUGLOG="/tmp/teamd-debug$DEV.log" TEAMD_CMD="/usr/bin/teamd"
DEBUG_LOG="/tmp/teamd-debug$DEV.log"
NAMESPACE_PREFIX="asic" NAMESPACE_PREFIX="asic"
if [ "$DEV" ]; then if [ "$DEV" ]; then
NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace