Skip to content

Commit

Permalink
[Techsupport]Handle SAI kv pair if present in sai common profile (#3196)
Browse files Browse the repository at this point in the history
### What I did
Handle the SAI key value pair if it is present in sai common profile rather than specific profile for mellanox platforms. The concept of common sai profile is introduced in sonic-net/sonic-buildimage#18074 . After this the techsupport started to fail because of the absence of SAI_DUMP_STORE_PATH

#### How I did it
Check if the variable is not present in platform specific file and then read the common file. If the common file is not accessible due to syncd being down, fallback to default path which is hardcoded.


#### How to verify it
Running techsupport and ensuring it exits with code 0
  • Loading branch information
dgsudharsan authored and mssonicbld committed Mar 21, 2024
1 parent f4ef768 commit 5bfc3b4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scripts/generate_dump
Original file line number Diff line number Diff line change
Expand Up @@ -1266,8 +1266,19 @@ collect_mellanox_dfw_dumps() {
trap 'handle_error $? $LINENO' ERR
local platform=$(python3 -c "from sonic_py_common import device_info; print(device_info.get_platform())")
local hwsku=$(python3 -c "from sonic_py_common import device_info; print(device_info.get_hwsku())")
local def_dump_path="/var/log/mellanox/sdk-dumps"
local sdk_dump_path=`cat /usr/share/sonic/device/${platform}/${hwsku}/sai.profile|grep "SAI_DUMP_STORE_PATH"|cut -d = -f2`

if [ -z $sdk_dump_path ]; then
# If the SAI_DUMP_STORE_PATH is not found in device specific sai profile, check in common sai profile
sdk_dump_path=`docker exec syncd cat /etc/mlnx/sai-common.profile | grep "SAI_DUMP_STORE_PATH" |cut -d = -f2`
if [ -z $sdk_dump_path ]; then
# If the above two mechanisms fail e.g. when syncd is not running , fallback to default sdk dump path
sdk_dump_path=$def_dump_path
fi
fi


if [[ ! -d $sdk_dump_path ]]; then
# This would mean the SAI_DUMP_STORE_PATH is not mounted on the host and is only accessible though the container
# This is a bad design and not recommended But there is nothing which restricts against it and thus the special handling
Expand Down

0 comments on commit 5bfc3b4

Please sign in to comment.