From 4a93e4cfa4102bc2c7529d5c76f06d8c91c1ed94 Mon Sep 17 00:00:00 2001 From: anamehra <54692434+anamehra@users.noreply.github.com> Date: Fri, 3 Mar 2023 15:53:33 -0800 Subject: [PATCH] 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/ --- files/scripts/syncd.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index 2a3bd133c4..8aacfe8f6c 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -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}