From 08742080d16ffadb41031e099c9587f7d0ed26c8 Mon Sep 17 00:00:00 2001 From: Vaibhav Hemant Dixit Date: Thu, 28 Sep 2023 09:37:21 -0700 Subject: [PATCH] [fast-reboot] Fix regression: set FAST_REBOOT state_db flag to support fast-reboot from older images (#16733) Why I did it Fix: #16699 Fast reboot is failing from old OS versions (eg., 201911 image) to latest (eg., master branch) after PR #15685 The system wide flag for FAST_REBOOT is still required when the base OS version does not support the new fast-reboot reconciliation logic (no db dump) --- files/build_templates/docker_image_ctl.j2 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 6ad6eed099..0a60ec17e6 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -247,6 +247,12 @@ function postStartAction() $SONIC_CFGGEN -j /etc/sonic/config_db$DEV.json --write-to-db fi fi + + if [[ "$BOOT_TYPE" == "fast" ]]; then + # this is the case when base OS version does not support fast-reboot with reconciliation logic (dump.rdb is absent) + # In this case, we need to set the flag to indicate fast-reboot is in progress. Set the key to expire in 3 minutes + $SONIC_DB_CLI STATE_DB SET "FAST_REBOOT|system" "1" "EX" "180" + fi fi if [ -e /tmp/pending_config_migration ] || [ -e /tmp/pending_config_initialization ]; then