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 (#3292)

* [chassis][midplane] Add notification to Supervisor when LC is graceful reboot

* Address review comment by adding log message when failed to create wentry in CHASSIS_STATE_DB

Signed-off-by: mlok <marty.lok@nokia.com>
  • Loading branch information
mlok-nokia authored May 15, 2024
1 parent 2fda252 commit 547d5ee
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions scripts/reboot
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,25 @@ 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"
status=$?
if [ $status -ne 0 ]; then
debug "Failed to notify Supervisor: Linecard reboot is expected"
fi
fi
fi
fi
}

parse_options $@

# Exit if not superuser
Expand All @@ -216,6 +235,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 547d5ee

Please sign in to comment.