From 8a7e38b3a30784b6a5957acd2aa7d65119243369 Mon Sep 17 00:00:00 2001 From: Lahav-Nvidia <158030815+lfridlander@users.noreply.github.com> Date: Thu, 22 Feb 2024 11:35:10 +0200 Subject: [PATCH] [Mellanox] Add N/A as a valid fan direction for Nvidia platforms (#17930) - Why I did it On some Nvidia platforms, fan direction could not be determined. Therefore 'N/A' becomes a valid value for those cases. - How I did it Add 'N/A' to the valid fan direction mapping, to avoid an error in the log. - How to verify it Check fan direction on Nvidia platforms, and make sure there aren't errors in the log. --- platform/mellanox/mlnx-platform-api/sonic_platform/fan.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py b/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py index 40dadb0f40..fba2463619 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py @@ -46,9 +46,11 @@ CONFIG_PATH = "/var/run/hw-management/config" FAN_DIR = "/var/run/hw-management/thermal/fan{}_dir" FAN_DIR_VALUE_EXHAUST = 0 FAN_DIR_VALUE_INTAKE = 1 +FAN_DIR_VALUE_NOT_APPLICABLE = 2 FAN_DIR_MAPPING = { FAN_DIR_VALUE_EXHAUST: FanBase.FAN_DIRECTION_EXHAUST, FAN_DIR_VALUE_INTAKE: FanBase.FAN_DIRECTION_INTAKE, + FAN_DIR_VALUE_NOT_APPLICABLE: FanBase.FAN_DIRECTION_NOT_APPLICABLE, } class MlnxFan(FanBase): @@ -170,7 +172,7 @@ class PsuFan(MlnxFan): Retrieves the fan's direction Returns: - A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST or FAN_DIRECTION_NOT_APPLICABLE depending on fan direction Notes: @@ -181,6 +183,7 @@ class PsuFan(MlnxFan): Air flow from QSFP side to fans side, for example: MSN2700-CS2R which means exhaust in community According to hw-mgmt: + 2 stands for N/A, in case fan direction could not be determined 1 stands for forward, in other words intake 0 stands for reverse, in other words exhaust """ @@ -275,7 +278,7 @@ class Fan(MlnxFan): Retrieves the fan's direction Returns: - A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST or FAN_DIRECTION_NOT_APPLICABLE depending on fan direction Notes: @@ -286,6 +289,7 @@ class Fan(MlnxFan): Air flow from QSFP side to fans side, for example: MSN2700-CS2R which means exhaust in community According to hw-mgmt: + 2 stands for N/A, in case fan direction could not be determined 1 stands for forward, in other words intake 0 stands for reverse, in other words exhaust """