Skip to content

Commit

Permalink
[teamd.sh] kill teamd docker on warm shutdown for faster shutdown (so…
Browse files Browse the repository at this point in the history
…nic-net#10219)

This can save 6 sec for teamd LAG restoration - the time between:

```
Mar  9 13:51:10.467757 r-panther-13 WARNING teamd#teamd_PortChannel1[28]: Got SIGUSR1.
Mar  9 13:52:33.310707 r-panther-13 INFO teamd#teamd_PortChannel1[27]: carrier changed to UP
```

- Why I did it
Optimize warm boot. Specifically reduce the time needed for LAG restoration.

- How I did it
Kill teamd docker after graceful shutdown of teamd processes.

- How to verify it
Run warm reboot.

Signed-off-by: Stepan Blyschak <[email protected]>
  • Loading branch information
stepanblyschak authored and qiluo-msft committed Mar 16, 2022
1 parent 149229e commit 8ce5e4e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion files/scripts/teamd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,17 @@ stop() {
# 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
docker exec -i ${SERVICE}$DEV pkill -USR2 -f ${TEAMD_CMD} || [ $? == 1 ]
fi

if [[ x"$WARM_BOOT" == x"true" ]] || [[ x"$FAST_BOOT" == x"true" ]]; then
while docker exec -i ${SERVICE}$DEV pgrep -f ${TEAMD_CMD} > /dev/null; do
sleep 0.05
done
docker kill ${SERVICE}$DEV &> /dev/null || debug "Docker ${SERVICE}$DEV is not running ($?) ..."
else
/usr/bin/${SERVICE}.sh stop $DEV
fi

/usr/bin/${SERVICE}.sh stop $DEV
debug "Stopped ${SERVICE}$DEV service..."
}

Expand Down

0 comments on commit 8ce5e4e

Please sign in to comment.