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] Check if warm restart flag is set when issuing a warm-reboot #1460

Merged
merged 3 commits into from
Mar 3, 2021
Merged
Changes from 2 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
14 changes: 14 additions & 0 deletions scripts/fast-reboot
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,19 @@ function save_counters_folder() {
fi
}

function check_warm_restart_in_progress() {
sonic-db-cli STATE_DB keys "WARM_RESTART_ENABLE_TABLE|*" | while read key ; do
if [[ "$(sonic-db-cli STATE_DB hget $key enable)" = "true" ]]; then
yxieca marked this conversation as resolved.
Show resolved Hide resolved
if [[ "${FORCE}" = "yes" ]]; then
debug "Ignoring warm restart flag for ${key#*|}"
else
echo "Warm restart flag for ${key#*|} is set. Please check if a warm restart for ${key#*|} is in progress."
exit "${EXIT_FAILURE}"
fi
fi
done
}

# main starts here
parseOptions $@

Expand All @@ -419,6 +432,7 @@ case "$REBOOT_TYPE" in
sonic-db-cli STATE_DB SET "FAST_REBOOT|system" "1" "EX" "180" &>/dev/null
;;
"warm-reboot")
check_warm_restart_in_progress
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also add support for ignoring (forcing through) this check. Just like we have an option (-f) to ignore Orchagent RESTARTCHECK, if some components are not reconciled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for this suggestion. Ignoring the check if -f is selected.

if [[ "$sonic_asic_type" == "mellanox" ]]; then
REBOOT_TYPE="fastfast-reboot"
BOOT_TYPE_ARG="fastfast"
Expand Down