Add support for platform syncd pre shutdown plugin (#13564)

Why I did it
Vendor platform may require running platform specific pre-shutdown routine before shutting down the syncd process which runs the SAI and vendor sdk instance.

How I did it
Added a platform script hook which will be executed if the plugin script is provided by the platform in device//plugins/
This commit is contained in:
anamehra 2023-03-03 15:53:33 -08:00 committed by mssonicbld
parent 5776f30025
commit 0c5ab622c4

View File

@ -105,6 +105,12 @@ function stopplatform1() {
fi
if [[ x$sonic_asic_platform != x"mellanox" ]] || [[ x$TYPE != x"cold" ]]; then
# Invoke platform specific pre shutdown routine.
PLATFORM=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' platform`
PLATFORM_PRE_SHUTDOWN="/usr/share/sonic/device/$PLATFORM/plugins/syncd_request_pre_shutdown"
[ -f $PLATFORM_PRE_SHUTDOWN ] && \
/usr/bin/docker exec -i syncd$DEV /usr/share/sonic/platform/plugins/syncd_request_pre_shutdown --${TYPE}
debug "${TYPE} shutdown syncd process ..."
/usr/bin/docker exec -i syncd$DEV /usr/bin/syncd_request_shutdown --${TYPE}