Skip to content

Commit ee56d54

Browse files
authored
[fast-reboot] Stop services after killing containers to prevent automatic restart (#572)
1 parent c718cab commit ee56d54

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

scripts/fast-reboot

+21-3
Original file line numberDiff line numberDiff line change
@@ -377,18 +377,30 @@ docker exec -i bgp pkill -9 zebra
377377
docker exec -i bgp pkill -9 bgpd || [ $? == 1 ]
378378
debug "Stopped bgp ..."
379379
380-
# Kill lldp, otherwise it sends informotion about reboot
380+
# Kill lldp, otherwise it sends informotion about reboot.
381+
# We call `docker kill lldp` to ensure the container stops as quickly as possible,
382+
# then immediately call `systemctl stop lldp` to prevent the service from
383+
# restarting the container automatically.
381384
docker kill lldp > /dev/null
385+
systemctl stop lldp
382386
383387
if [[ "$REBOOT_TYPE" = "fast-reboot" ]]; then
384388
# Kill teamd, otherwise it gets down all LAGs
389+
# We call `docker kill teamd` to ensure the container stops as quickly as possible,
390+
# then immediately call `systemctl stop teamd` to prevent the service from
391+
# restarting the container automatically.
385392
# Note: teamd must be killed before syncd, because it will send the last packet through CPU port
386393
# TODO: stop teamd gracefully to allow teamd to send last valid update to be sure we'll have 90 seconds reboot time
387394
docker kill teamd > /dev/null
395+
systemctl stop teamd
388396
fi
389397
390-
# Kill swss dockers
398+
# Kill swss Docker container
399+
# We call `docker kill swss` to ensure the container stops as quickly as possible,
400+
# then immediately call `systemctl stop swss` to prevent the service from
401+
# restarting the container automatically.
391402
docker kill swss > /dev/null
403+
systemctl stop swss
392404
393405
# Pre-shutdown syncd
394406
if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" ]]; then
@@ -425,7 +437,13 @@ systemctl stop syncd
425437
debug "Stopped syncd ..."
426438
427439
# Kill other containers to make the reboot faster
428-
docker ps -q | xargs docker kill > /dev/null
440+
# We call `docker kill ...` to ensure the container stops as quickly as possible,
441+
# then immediately call `systemctl stop ...` to prevent the service from
442+
# restarting the container automatically.
443+
for CONTAINER_NAME in $(docker ps --format '{{.Names}}'); do
444+
docker kill $CONTAINER_NAME > /dev/null
445+
systemctl stop $CONTAINER_NAME
446+
done
429447
430448
# Stop the docker container engine. Otherwise we will have a broken docker storage
431449
systemctl stop docker.service

0 commit comments

Comments
 (0)