Skip to content

Commit

Permalink
[warm-reboot] initialize warm reboot state table before warm rebooting (
Browse files Browse the repository at this point in the history
#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 <ying.xie@microsoft.com>

* fix typo

* optimize state deletion
  • Loading branch information
yxieca authored Mar 30, 2019
1 parent 06cd99f commit 170fed9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions scripts/fast-reboot
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,20 @@ function clear_warm_boot()
fi
}
function init_warm_reboot_states()
{
# If the current running instanace was booted up with warm reboot. Then
# the current DB contents will likely mark warm reboot is done.
# Clear these states so that the next boot up image won't get confused.
if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" ]]; then
redis-cli -n 6 eval "
for _, key in ipairs(redis.call('keys', 'WARM_RESTART_TABLE|*')) do
redis.call('hdel', key, 'state')
end
" 0 >/dev/null
fi
}
function initialize_pre_shutdown()
{
debug "Initialize pre-shutdown ..."
Expand Down Expand Up @@ -285,6 +299,8 @@ if [[ "$REBOOT_TYPE" = "fast-reboot" ]]; then
/usr/bin/fast-reboot-dump.py -t /host/fast-reboot
fi
init_warm_reboot_states
setup_control_plane_assistant
if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" ]]; then
Expand Down

0 comments on commit 170fed9

Please sign in to comment.