Skip to content

Commit dd3c2c3

Browse files
authored
[warm-reboot] Check if warm restart flag is set when issuing a warm-reboot (sonic-net#1460)
Check if any warm restart flag is set when issuing a warm-reboot. This check avoids starting a warm reboot while another warm restart is in progress. In the scenario where a warm reboot is issued with another warm restart in progress, the warm restart flag may be reset and part of the components have a risk of doing cold reboot.
1 parent e32b5ac commit dd3c2c3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

scripts/fast-reboot

+14
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,19 @@ function save_counters_folder() {
398398
fi
399399
}
400400
401+
function check_warm_restart_in_progress() {
402+
sonic-db-cli STATE_DB keys "WARM_RESTART_ENABLE_TABLE|*" | while read key ; do
403+
if [[ x"$(sonic-db-cli STATE_DB hget $key enable)" == x"true" ]]; then
404+
if [[ x"${FORCE}" == x"yes" ]]; then
405+
debug "Ignoring warm restart flag for ${key#*|}"
406+
else
407+
echo "Warm restart flag for ${key#*|} is set. Please check if a warm restart for ${key#*|} is in progress."
408+
exit "${EXIT_FAILURE}"
409+
fi
410+
fi
411+
done
412+
}
413+
401414
# main starts here
402415
parseOptions $@
403416
@@ -419,6 +432,7 @@ case "$REBOOT_TYPE" in
419432
sonic-db-cli STATE_DB SET "FAST_REBOOT|system" "1" "EX" "180" &>/dev/null
420433
;;
421434
"warm-reboot")
435+
check_warm_restart_in_progress
422436
if [[ "$sonic_asic_type" == "mellanox" ]]; then
423437
REBOOT_TYPE="fastfast-reboot"
424438
BOOT_TYPE_ARG="fastfast"

0 commit comments

Comments
 (0)