Skip to content

Commit 926d033

Browse files
tshalvimssonicbld
authored andcommitted
[Mellanox] Enhance is_module_host_management_mode to also check syncd's sai.profile (sonic-net#19261)
- Why I did it Two steps (among others) are required to enable the host CMIS management feature: enabling it in the switch's sai.profile and performing a config reload. During the timeframe between these two steps, the control sysfs might be accessed, but they will not be present on the system until the latter step, the config reload, is completed. The code should try to access the control sysfs only after the config reload step. A good indication that this has been done is to check if the relevant entry is included in syncd's sai.profile. In contrast to the switch's sai.profile, syncd's sai.profile is only updated with the Host CMIS management support flag after the reload is complete. - How I did it I updated the is_module_host_management_mode() implementation to first look for the Host CMIS management support flag in syncd's sai.profile, and only if it does not exist for some reason, look for it in the switch's sai.profile. - How to verify it Add the Host CMIS management support flag to the switch's sai.profile and verify that the following log does not appear: ERR pmon#xcvrd: Exception occured at DomInfoUpdateTask thread due to Exception('control sysfs for SFP 20 does not exist')
1 parent 0403cc1 commit 926d033

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,14 @@ def get_cpld_component_list(cls):
267267
@classmethod
268268
@utils.read_only_cache()
269269
def is_module_host_management_mode(cls):
270-
from sonic_py_common import device_info
271-
_, hwsku_dir = device_info.get_paths_to_platform_and_hwsku_dirs()
272-
sai_profile_file = os.path.join(hwsku_dir, 'sai.profile')
270+
sai_profile_file = '/tmp/sai.profile'
271+
if not os.path.exists(sai_profile_file):
272+
from sonic_py_common import device_info
273+
_, hwsku_dir = device_info.get_paths_to_platform_and_hwsku_dirs()
274+
sai_profile_file = os.path.join(hwsku_dir, 'sai.profile')
273275
data = utils.read_key_value_file(sai_profile_file, delimeter='=')
274276
return data.get('SAI_INDEPENDENT_MODULE_MODE') == '1'
275-
277+
276278
@classmethod
277279
def wait_platform_ready(cls):
278280
"""

0 commit comments

Comments
 (0)