97a091abd2
#### Why I did it When a kernel crash occurs, the system will reboot to the kdump capture kernel if kdump is enabled (`config kdump enable`). In the kdump capture boot, it only stores the crash information, and then reboot the system to a normal boot. In this boot, no SONiC service is started but it invokes `reboot` which is actually the SONiC reboot that depends on SONiC services. There is a logic to skip all SONiC stuff and invoke platform reboot in SONiC reboot to avoid issues. However, on Nvidia platforms, the platform reboot still depends on SONiC services, which can cause issues. So, the Debian reboot is called directly in platform reboot if it is invoked from the kdump capture boot. #### How I did it Manual test
56 lines
1.2 KiB
Bash
Executable File
56 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
declare -r EXIT_SUCCESS="0"
|
|
declare -r EXIT_ERROR="1"
|
|
|
|
declare -r PENDING_COMPONENT_FW="/usr/bin/install-pending-fw.py"
|
|
declare -r FW_UPGRADE_SCRIPT="/usr/bin/mlnx-fw-upgrade.sh"
|
|
declare -r SYSFS_PWR_CYCLE="/var/run/hw-management/system/pwr_cycle"
|
|
|
|
FORCE_REBOOT="no"
|
|
|
|
function ParseArguments() {
|
|
while [ $# -ge 1 ]; do
|
|
case "$1" in
|
|
-f|--force)
|
|
FORCE_REBOOT="yes"
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
}
|
|
|
|
function SafePwrCycle() {
|
|
sync; sync
|
|
umount -fa > /dev/null 2>&1
|
|
echo 1 > $SYSFS_PWR_CYCLE
|
|
}
|
|
|
|
ParseArguments "$@"
|
|
|
|
# Reboot immediately if the kdump capture kernel is running
|
|
VMCORE_FILE=/proc/vmcore
|
|
if [ -s $VMCORE_FILE ]; then
|
|
sync; sync
|
|
umount -fa > /dev/null 2>&1
|
|
|
|
# Run Debian reboot because the platform reboot isn't available
|
|
/sbin/reboot
|
|
fi
|
|
|
|
|
|
${FW_UPGRADE_SCRIPT} --upgrade --verbose
|
|
EXIT_CODE="$?"
|
|
if [[ "${EXIT_CODE}" != "${EXIT_SUCCESS}" ]]; then
|
|
echo "Failed to burn MLNX FW: errno=${EXIT_CODE}"
|
|
|
|
if [[ "${FORCE_REBOOT}" != "yes" ]]; then
|
|
echo "Reboot is interrupted: use -f|--force to override"
|
|
exit "${EXIT_ERROR}"
|
|
fi
|
|
fi
|
|
|
|
${PENDING_COMPONENT_FW}
|
|
|
|
SafePwrCycle
|