Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[warm-reboot] initialize warm reboot state table before warm rebooting #492

Merged
merged 3 commits into from
Mar 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Copy link
Contributor

@qiluo-msft qiluo-msft Mar 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

init_warm_reboot_states [](start = 9, length = 23)

You could move code into backup_database(). And consider to adapt the optimization there. #Closed

Copy link
Contributor Author

@yxieca yxieca Mar 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would interfere the warm reboot. Syncd warmshutdown uses this table to coordinate operations. Some module might (not today, but maybe in the future) want to leave information to be handled after warm reboot is done. So it would be best to clear the table before any real warm reboot operation started.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorporated the optimization. Thanks!

{
# 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