diff --git a/scripts/fast-reboot b/scripts/fast-reboot index e0450f802b..13ad66a25e 100755 --- a/scripts/fast-reboot +++ b/scripts/fast-reboot @@ -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 $@ @@ -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"