Skip to content

[Mellanox] Add N/A as a valid fan direction for Nvidia platforms #17930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions platform/mellanox/mlnx-platform-api/sonic_platform/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which one will be better, 'N/A' or 'UNKNOWN'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The schema values support 'N/A', and also the 'FanBase' interface refers to this value as not applicable. So I think the 'N/A' value is better.

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):
Expand Down Expand Up @@ -170,7 +172,7 @@ def get_direction(self):
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:
Expand All @@ -181,6 +183,7 @@ def get_direction(self):
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
"""
Expand Down Expand Up @@ -275,7 +278,7 @@ def get_direction(self):
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:
Expand All @@ -286,6 +289,7 @@ def get_direction(self):
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
"""
Expand Down