Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fast-reboot] Stop services after killing containers to prevent automatic restart #572

Merged
merged 1 commit into from
Jul 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions scripts/fast-reboot
Original file line number Diff line number Diff line change
Expand Up @@ -377,18 +377,30 @@ docker exec -i bgp pkill -9 zebra
docker exec -i bgp pkill -9 bgpd || [ $? == 1 ]
debug "Stopped bgp ..."

# Kill lldp, otherwise it sends informotion about reboot
# Kill lldp, otherwise it sends informotion about reboot.
# We call `docker kill lldp` to ensure the container stops as quickly as possible,
# then immediately call `systemctl stop lldp` to prevent the service from
# restarting the container automatically.
docker kill lldp > /dev/null
systemctl stop lldp

if [[ "$REBOOT_TYPE" = "fast-reboot" ]]; then
# Kill teamd, otherwise it gets down all LAGs
# We call `docker kill teamd` to ensure the container stops as quickly as possible,
# then immediately call `systemctl stop teamd` to prevent the service from
# restarting the container automatically.
# Note: teamd must be killed before syncd, because it will send the last packet through CPU port
# TODO: stop teamd gracefully to allow teamd to send last valid update to be sure we'll have 90 seconds reboot time
docker kill teamd > /dev/null
systemctl stop teamd
fi

# Kill swss dockers
# Kill swss Docker container
# We call `docker kill swss` to ensure the container stops as quickly as possible,
# then immediately call `systemctl stop swss` to prevent the service from
# restarting the container automatically.
docker kill swss > /dev/null
systemctl stop swss

# Pre-shutdown syncd
if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" ]]; then
Expand Down Expand Up @@ -425,7 +437,13 @@ systemctl stop syncd
debug "Stopped syncd ..."

# Kill other containers to make the reboot faster
docker ps -q | xargs docker kill > /dev/null
# We call `docker kill ...` to ensure the container stops as quickly as possible,
# then immediately call `systemctl stop ...` to prevent the service from
# restarting the container automatically.
for CONTAINER_NAME in $(docker ps --format '{{.Names}}'); do
docker kill $CONTAINER_NAME > /dev/null
systemctl stop $CONTAINER_NAME
done

# Stop the docker container engine. Otherwise we will have a broken docker storage
systemctl stop docker.service
Expand Down