From aa7123189e96fe6eb6a8d82147294e58834597aa Mon Sep 17 00:00:00 2001 From: Lawrence Lee Date: Tue, 16 Mar 2021 18:35:54 -0700 Subject: [PATCH] [reboot]: Stop mux before reboot on dual ToR (#1500) If the script detects it is running on a dual ToR system, stop the mux container before shutting down syncd This is necessary to prevent some links from flapping when the standby ToR is rebooted - when reboot stop syncd, the linkmgr will stop receiving heartbeats and will then tell the mux to switchover. However, since the device is rebooting, no heartbeats will be sent out. The peer ToR will see this absence of heartbeats and tell the mux to switch back to itself (the peer ToR), causing the flap. By stopping the mux container before shutting down syncd, we prevent the rebooting ToR from switching the mux. Signed-off-by: Lawrence Lee --- scripts/reboot | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/reboot b/scripts/reboot index 8b1f9d60c328..ee10c77ba3d0 100755 --- a/scripts/reboot +++ b/scripts/reboot @@ -24,6 +24,7 @@ fi REBOOT_USER=$(logname) PLATFORM=$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) ASIC_TYPE=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) +SUBTYPE=$(sonic-cfggen -d -v DEVICE_METADATA.localhost.subtype) VERBOSE=no EXIT_NEXT_IMAGE_NOT_EXISTS=4 EXIT_SONIC_INSTALLER_VERIFY_REBOOT=21 @@ -52,6 +53,10 @@ function tag_images() function stop_sonic_services() { + if [[ x"$SUBTYPE" == x"DualToR" ]]; then + debug "DualToR detected, stopping mux container before reboot..." + systemctl stop mux + fi if [[ x"$ASIC_TYPE" != x"mellanox" ]]; then debug "Stopping syncd process..." docker exec -i syncd /usr/bin/syncd_request_shutdown --cold > /dev/null