Skip to content

Commit 170fed9

Browse files
authored
[warm-reboot] initialize warm reboot state table before warm rebooting (#492)
* [warm-reboot] initialize warm reboot state table before warm rebooting Make sure that when the new image boots up, the component state won't be 'reconciled'. Signed-off-by: Ying Xie <[email protected]> * fix typo * optimize state deletion
1 parent 06cd99f commit 170fed9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

scripts/fast-reboot

+16
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,20 @@ function clear_warm_boot()
106106
fi
107107
}
108108
109+
function init_warm_reboot_states()
110+
{
111+
# If the current running instanace was booted up with warm reboot. Then
112+
# the current DB contents will likely mark warm reboot is done.
113+
# Clear these states so that the next boot up image won't get confused.
114+
if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" ]]; then
115+
redis-cli -n 6 eval "
116+
for _, key in ipairs(redis.call('keys', 'WARM_RESTART_TABLE|*')) do
117+
redis.call('hdel', key, 'state')
118+
end
119+
" 0 >/dev/null
120+
fi
121+
}
122+
109123
function initialize_pre_shutdown()
110124
{
111125
debug "Initialize pre-shutdown ..."
@@ -285,6 +299,8 @@ if [[ "$REBOOT_TYPE" = "fast-reboot" ]]; then
285299
/usr/bin/fast-reboot-dump.py -t /host/fast-reboot
286300
fi
287301
302+
init_warm_reboot_states
303+
288304
setup_control_plane_assistant
289305
290306
if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" ]]; then

0 commit comments

Comments
 (0)