From 576c9efc0dc33a047b9bb31fd58b53866cd62206 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Tue, 12 Apr 2022 12:14:34 +0300 Subject: [PATCH] [scripts/fast-reboot] stop timers in advance (#2131) - What I did Service timers may trigger service start in the middle of warm-reboot. Stopping them in advance prevents this issue. - How I did it Stopped all service timers that are part of sonic-delayed.target - How to verify it Run warm-reboot. Signed-off-by: Stepan Blyschak --- scripts/fast-reboot | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/fast-reboot b/scripts/fast-reboot index 05e6f3eed9..5749e3745a 100755 --- a/scripts/fast-reboot +++ b/scripts/fast-reboot @@ -670,6 +670,13 @@ if [ -x ${LOG_SSD_HEALTH} ]; then ${LOG_SSD_HEALTH} fi +# Stop any timers to prevent any containers starting in the middle of the process. +TIMERS=$(systemctl list-dependencies --plain sonic-delayed.target | sed 1d) +for timer in ${TIMERS}; do + debug "Stopping ${timer} ..." + systemctl stop ${timer} + debug "Stopped ${timer} ..." +done if [[ -f ${SHUTDOWN_ORDER_FILE} ]]; then SERVICES_TO_STOP="$(cat ${SHUTDOWN_ORDER_FILE})"