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] Fix failures of warm reboot on disconnect of ssh session #1529

Merged
merged 3 commits into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion doc/Command-Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -8927,7 +8927,7 @@ This command requires root privilege.

- Usage:
```
warm-reboot [-h|-?|-v|-f|-r|-k|-x|-c <control plane assistant IP list>|-s]
warm-reboot [-h|-?|-v|-f|-r|-k|-x|-c <control plane assistant IP list>|-s|-D]
```

- Parameters:
Expand All @@ -8941,6 +8941,7 @@ This command requires root privilege.
-c : specify control plane assistant IP list
-s : strict mode: do not proceed without:
- control plane assistant IP list.
-D : detached mode - closing terminal will not cause stopping reboot
```

- Example:
Expand Down
18 changes: 17 additions & 1 deletion scripts/fast-reboot
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ LOG_SSD_HEALTH="/usr/local/bin/log_ssd_health"
PLATFORM_FWUTIL_AU_REBOOT_HANDLE="platform_fw_au_reboot_handle"
SSD_FW_UPDATE="ssd-fw-upgrade"
TAG_LATEST=yes
DETACH=no
LOG_PATH="/var/log/${REBOOT_TYPE}.txt"

# Require 100M available on the hard drive for warm reboot temp files,
# Size is in 1K blocks:
Expand Down Expand Up @@ -73,13 +75,14 @@ function showHelpAndExit()
echo " -s : strict mode: do not proceed without:"
echo " - control plane assistant IP list."
echo " -t : Don't tag the current kube images as latest"
echo " -D : detached mode - closing terminal will not cause stopping reboot"

exit "${EXIT_SUCCESS}"
}

function parseOptions()
{
while getopts "vfidh?rkxc:s" opt; do
while getopts "vfidh?rkxc:sD" opt; do #TODO "t" is missing
case ${opt} in
h|\? )
showHelpAndExit
Expand Down Expand Up @@ -114,6 +117,9 @@ function parseOptions()
t )
TAG_LATEST=no
;;
D )
DETACH=yes
;;
esac
done
}
Expand Down Expand Up @@ -487,8 +493,18 @@ then
exit "${EXIT_FAILURE}"
fi


# re-run the script in background mode with detaching from the terminal session
if [[ x"${DETACH}" == x"yes" && x"${ALREADY_DETACHED}" == x"" ]]; then
echo "Detaching the process from the terminal session. Redirecting output to ${LOG_PATH}."
ALREADY_DETACHED=yes $0 "$@" &>$LOG_PATH & disown %%
exit $?
fi


check_conflict_boot_in_fw_update


sonic_asic_type=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type)

# Check reboot type supported
Expand Down