Skip to content

Commit

Permalink
[chassis][midplane] Add notification to Supervisor when LC is gracefu…
Browse files Browse the repository at this point in the history
…l reboot

Signed-off-by: mlok <marty.lok@nokia.com>
  • Loading branch information
mlok-nokia committed Apr 25, 2024
1 parent df94636 commit c115038
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions scripts/reboot
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,21 @@ function parse_options()
done
}

function linecard_reboot_notify_supervisor()
{
is_linecard=$(python3 -c 'from sonic_py_common import device_info; print("True") if device_info.is_chassis() == True and device_info.is_supervisor() == False else print("False")')
if [ $is_linecard == "True" ]; then
key=$(sonic-db-cli STATE_DB keys "CHASSIS_MODULE_TABLE|LINE-CARD*")
status=$?
if [ $status -eq 0 ]; then
module="${key#CHASSIS_MODULE_TABLE}"
if [ ! -z module ]; then
sonic-db-cli CHASSIS_STATE_DB hset "CHASSIS_MODULE_REBOOT_INFO_TABLE${module}" "reboot" "expected"
fi
fi
fi
}

parse_options $@

# Exit if not superuser
Expand All @@ -216,6 +231,9 @@ reboot_pre_check
# Tag remotely deployed images as local
tag_images

# Linecard reboot notify supervisor
linecard_reboot_notify_supervisor

# Stop SONiC services gracefully.
stop_sonic_services

Expand Down

0 comments on commit c115038

Please sign in to comment.