Skip to content

Commit 3579059

Browse files
lfridlandersonic-otn
authored andcommitted
[Mellanox] Add N/A as a valid fan direction for Nvidia platforms (sonic-net#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.
1 parent 7c6cbd0 commit 3579059

File tree

1 file changed

+6
-2
lines changed
  • platform/mellanox/mlnx-platform-api/sonic_platform

1 file changed

+6
-2
lines changed

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

+6-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@
4646
FAN_DIR = "/var/run/hw-management/thermal/fan{}_dir"
4747
FAN_DIR_VALUE_EXHAUST = 0
4848
FAN_DIR_VALUE_INTAKE = 1
49+
FAN_DIR_VALUE_NOT_APPLICABLE = 2
4950
FAN_DIR_MAPPING = {
5051
FAN_DIR_VALUE_EXHAUST: FanBase.FAN_DIRECTION_EXHAUST,
5152
FAN_DIR_VALUE_INTAKE: FanBase.FAN_DIRECTION_INTAKE,
53+
FAN_DIR_VALUE_NOT_APPLICABLE: FanBase.FAN_DIRECTION_NOT_APPLICABLE,
5254
}
5355

5456
class MlnxFan(FanBase):
@@ -170,7 +172,7 @@ def get_direction(self):
170172
Retrieves the fan's direction
171173
172174
Returns:
173-
A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST
175+
A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST or FAN_DIRECTION_NOT_APPLICABLE
174176
depending on fan direction
175177
176178
Notes:
@@ -181,6 +183,7 @@ def get_direction(self):
181183
Air flow from QSFP side to fans side, for example: MSN2700-CS2R
182184
which means exhaust in community
183185
According to hw-mgmt:
186+
2 stands for N/A, in case fan direction could not be determined
184187
1 stands for forward, in other words intake
185188
0 stands for reverse, in other words exhaust
186189
"""
@@ -275,7 +278,7 @@ def get_direction(self):
275278
Retrieves the fan's direction
276279
277280
Returns:
278-
A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST
281+
A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST or FAN_DIRECTION_NOT_APPLICABLE
279282
depending on fan direction
280283
281284
Notes:
@@ -286,6 +289,7 @@ def get_direction(self):
286289
Air flow from QSFP side to fans side, for example: MSN2700-CS2R
287290
which means exhaust in community
288291
According to hw-mgmt:
292+
2 stands for N/A, in case fan direction could not be determined
289293
1 stands for forward, in other words intake
290294
0 stands for reverse, in other words exhaust
291295
"""

0 commit comments

Comments
 (0)