Skip to content

Commit

Permalink
[201911] platform pre-check for reboot (#1472)
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.
How I did it
On branch reboot_pre_check_201911
Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git checkout -- ..." to discard changes in working directory)

    modified:   scripts/reboot
How to verify it
Write a platform pre check script(platform_reboot_pre_check) and place it in /usr/share/sonic/device/<HWSKU>/ 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 Mar 11, 2021
1 parent d86af49 commit 517cdb4
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 @@ -7,6 +7,7 @@ ASIC_TYPE=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type)
DEVPATH="/usr/share/sonic/device"
PLAT_REBOOT="platform_reboot"
REBOOT_CAUSE_FILE="/host/reboot-cause/reboot-cause.txt"
PLATFORM_REBOOT_PRE_CHECK="platform_reboot_pre_check"
VERBOSE=no
EXIT_NEXT_IMAGE_NOT_EXISTS=4

Expand Down Expand Up @@ -72,6 +73,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

# Make sure that the next image exists
if [[ ! -d ${IMAGE_PATH} ]]; then
VERBOSE=yes debug "Next image ${NEXT_SONIC_IMAGE} doesn't exist ..."
Expand Down

0 comments on commit 517cdb4

Please sign in to comment.