Skip to content

Commit

Permalink
[warm-reboot] Check if warm restart flag is set when issuing a warm-r…
Browse files Browse the repository at this point in the history
…eboot (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.
  • Loading branch information
shi-su committed Mar 3, 2021
1 parent e32b5ac commit dd3c2c3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scripts/fast-reboot
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,19 @@ function save_counters_folder() {
fi
}
function check_warm_restart_in_progress() {
sonic-db-cli STATE_DB keys "WARM_RESTART_ENABLE_TABLE|*" | while read key ; do
if [[ x"$(sonic-db-cli STATE_DB hget $key enable)" == x"true" ]]; then
if [[ x"${FORCE}" == x"yes" ]]; then
debug "Ignoring warm restart flag for ${key#*|}"
else
echo "Warm restart flag for ${key#*|} is set. Please check if a warm restart for ${key#*|} is in progress."
exit "${EXIT_FAILURE}"
fi
fi
done
}
# main starts here
parseOptions $@
Expand All @@ -419,6 +432,7 @@ case "$REBOOT_TYPE" in
sonic-db-cli STATE_DB SET "FAST_REBOOT|system" "1" "EX" "180" &>/dev/null
;;
"warm-reboot")
check_warm_restart_in_progress
if [[ "$sonic_asic_type" == "mellanox" ]]; then
REBOOT_TYPE="fastfast-reboot"
BOOT_TYPE_ARG="fastfast"
Expand Down

0 comments on commit dd3c2c3

Please sign in to comment.