Skip to content

Commit

Permalink
platform pre-check for reboot in 202012 branch (sonic-net#1788)
Browse files Browse the repository at this point in the history
What I did
Added platform pre check support in reboot script.
Checking platform based changes before stopping dockers and sonic services.
Porting changes in 202012 branch.

How to verify it
Write a platform pre check script(platform_reboot_pre_check) and place it in /usr/share/sonic/device// directory.
If the script exit with status 0, reboot will be proceeded.
If script exit with non-zero status, the reboot script gets stopped.
  • Loading branch information
santhosh-kt authored Sep 7, 2021
1 parent 0e0478b commit a9c6970
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/reboot
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DEVPATH="/usr/share/sonic/device"
PLAT_REBOOT="platform_reboot"
PLATFORM_UPDATE_REBOOT_CAUSE="platform_update_reboot_cause"
REBOOT_CAUSE_FILE="/host/reboot-cause/reboot-cause.txt"
PLATFORM_REBOOT_PRE_CHECK="platform_reboot_pre_check"
REBOOT_TIME=$(date)

# Reboot immediately if we run the kdump capture kernel
Expand Down Expand Up @@ -121,6 +122,11 @@ function reboot_pre_check()
fi
rm ${filename}

if [ -x ${DEVPATH}/${PLATFORM}/${PLATFORM_REBOOT_PRE_CHECK} ]; then
${DEVPATH}/${PLATFORM}/${PLATFORM_REBOOT_PRE_CHECK}
[[ $? -ne 0 ]] && exit $?
fi

# Verify the next image by sonic-installer
local message=$(sonic-installer verify-next-image 2>&1)
if [ $? -ne 0 ]; then
Expand Down

0 comments on commit a9c6970

Please sign in to comment.