@@ -52,6 +52,17 @@ function check_warm_boot()
5252 WARM_BOOT=` sonic-db-cli STATE_DB hget " WARM_RESTART_ENABLE_TABLE|system" enable`
5353}
5454
55+ function check_fast_reboot()
56+ {
57+ debug " Checking if fast-reboot is enabled..."
58+ FAST_REBOOT=` sonic-db-cli STATE_DB hget " FAST_RESTART_ENABLE_TABLE|system" enable`
59+ if [[ x" ${FAST_REBOOT} " == x" true" ]]; then
60+ debug " Fast-reboot is enabled..."
61+ else
62+ debug " Fast-reboot is disabled..."
63+ fi
64+ }
65+
5566
5667function wait_for_database_service()
5768{
@@ -97,6 +108,12 @@ function finalize_warm_boot()
97108 sudo config warm_restart disable
98109}
99110
111+ function finalize_fast_reboot()
112+ {
113+ debug " Finalizing fast-reboot..."
114+ sonic-db-cli STATE_DB hset " FAST_RESTART_ENABLE_TABLE|system" " enable" " false" & > /dev/null
115+ }
116+
100117function stop_control_plane_assistant()
101118{
102119 if [[ -x ${ASSISTANT_SCRIPT} ]]; then
@@ -118,14 +135,20 @@ function restore_counters_folder()
118135
119136wait_for_database_service
120137
138+ check_fast_reboot
121139check_warm_boot
122140
123141if [[ x" ${WARM_BOOT} " != x" true" ]]; then
124142 debug " warmboot is not enabled ..."
125- exit 0
143+ if [[ x" ${FAST_REBOOT} " != x" true" ]]; then
144+ debug " fastboot is not enabled ..."
145+ exit 0
146+ fi
126147fi
127148
128- restore_counters_folder
149+ if [[ (x" ${WARM_BOOT} " == x" true" ) && (x" ${FAST_REBOOT} " ! = x" true" ) ]]; then
150+ restore_counters_folder
151+ fi
129152
130153get_component_list
131154
@@ -142,14 +165,22 @@ for i in `seq 60`; do
142165 sleep 5
143166done
144167
145- stop_control_plane_assistant
168+ if [[ (x" ${WARM_BOOT} " == x" true" ) && (x" ${FAST_REBOOT} " ! = x" true" ) ]]; then
169+ stop_control_plane_assistant
170+ fi
146171
147172# Save DB after stopped control plane assistant to avoid extra entries
148- debug " Save in-memory database after warm reboot ..."
173+ debug " Save in-memory database after warm/fast reboot ..."
149174config save -y
150175
151176if [[ -n " ${list} " ]]; then
152177 debug " Some components didn't finish reconcile: ${list} ..."
153178fi
154179
155- finalize_warm_boot
180+ if [ x" ${FAST_REBOOT} " == x" true" ]; then
181+ finalize_fast_reboot
182+ fi
183+
184+ if [ x" ${WARM_BOOT} " == x" true" ]; then
185+ finalize_warm_boot
186+ fi
0 commit comments