From 9f72383a1905a07f553ccb15a5b7027df9f5de7c Mon Sep 17 00:00:00 2001 From: afeigin Date: Tue, 14 Mar 2023 10:05:09 +0000 Subject: [PATCH] support compatibility for fast-reboot from previous versions (prior 202205) --- files/build_templates/docker_image_ctl.j2 | 3 ++- .../image_config/warmboot-finalizer/finalize-warmboot.sh | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index d2f22ec89c31..6879aeb703f7 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -239,7 +239,8 @@ function postStartAction() fi if [[ "$BOOT_TYPE" == "fast" ]]; then - $SONIC_DB_CLI STATE_DB HSET "FAST_RESTART_ENABLE_TABLE|system" "enable" "true" + # set the key to expire in 3 minutes + $SONIC_DB_CLI STATE_DB SET "FAST_REBOOT|system" "1" "EX" "180" fi $SONIC_DB_CLI CONFIG_DB SET "CONFIG_DB_INITIALIZED" "1" diff --git a/files/image_config/warmboot-finalizer/finalize-warmboot.sh b/files/image_config/warmboot-finalizer/finalize-warmboot.sh index f00036111ef7..597a9cceacb3 100755 --- a/files/image_config/warmboot-finalizer/finalize-warmboot.sh +++ b/files/image_config/warmboot-finalizer/finalize-warmboot.sh @@ -140,13 +140,13 @@ check_warm_boot if [[ x"${WARM_BOOT}" != x"true" ]]; then debug "warmboot is not enabled ..." - if [[ x"${FAST_BOOT}" != x"true" ]]; then + if [[ x"${FAST_REBOOT}" != x"true" ]]; then debug "fastboot is not enabled ..." exit 0 fi fi -if [[ x"${WARM_BOOT}" == x"true" ]]; then +if [[ (x"${WARM_BOOT}" == x"true") && (x"${FAST_REBOOT}" != x"true") ]]; then restore_counters_folder fi @@ -165,7 +165,7 @@ for i in `seq 60`; do sleep 5 done -if [[ x"${WARM_BOOT}" == x"true" ]]; then +if [[ (x"${WARM_BOOT}" == x"true") && (x"${FAST_REBOOT}" != x"true") ]]; then stop_control_plane_assistant fi @@ -180,6 +180,7 @@ fi if [ x"${FAST_REBOOT}" == x"true" ]; then finalize_fast_reboot fi + if [ x"${WARM_BOOT}" == x"true" ]; then finalize_warm_boot -fi +fi \ No newline at end of file