Skip to content

Commit e4ff4d2

Browse files
Junchao-Mellanoxjudyjoseph
authored andcommitted
[Mellanox] Fan speed should not be 100% when PSU is powered off (#9258)
- Why I did it When PSU is powered off, the PSU is still on the switch and the air flow is still the same. In this case, it is not necessary to set FAN speed to 100%. - How I did it When PSU is powered of, don't treat it as absent. - How to verify it Adjust existing unit test case Add new case in sonic-mgmt
1 parent fa0ae42 commit e4ff4d2

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def collect(self, chassis):
4545
elif status and fan in self._fault_fans:
4646
self._fault_fans.remove(fan)
4747
self._status_changed = True
48-
48+
4949

5050
def get_absence_fans(self):
5151
"""
@@ -96,12 +96,12 @@ def collect(self, chassis):
9696
"""
9797
self._status_changed = False
9898
for psu in chassis.get_all_psus():
99-
if psu.get_presence() and psu.get_powergood_status() and psu not in self._presence_psus:
99+
if psu.get_presence() and psu not in self._presence_psus:
100100
self._presence_psus.add(psu)
101101
self._status_changed = True
102102
if psu in self._absence_psus:
103103
self._absence_psus.remove(psu)
104-
elif (not psu.get_presence() or not psu.get_powergood_status()) and psu not in self._absence_psus:
104+
elif (not psu.get_presence()) and psu not in self._absence_psus:
105105
self._absence_psus.add(psu)
106106
self._status_changed = True
107107
if psu in self._presence_psus:

platform/mellanox/mlnx-platform-api/tests/test_thermal_policy.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ def test_psu_info():
8181

8282
psu_list[0].powergood = False
8383
psu_info.collect(chassis)
84-
assert len(psu_info.get_absence_psus()) == 1
85-
assert len(psu_info.get_presence_psus()) == 0
86-
assert psu_info.is_status_changed()
84+
assert len(psu_info.get_absence_psus()) == 0
85+
assert len(psu_info.get_presence_psus()) == 1
86+
assert not psu_info.is_status_changed()
8787

8888

8989
def test_fan_policy(thermal_manager):
@@ -324,12 +324,12 @@ def test_load_control_thermal_algo_action():
324324
json_str = '{\"status\": \"false\"}'
325325
json_obj = json.loads(json_str)
326326
action.load_from_json(json_obj)
327-
assert not action.status
327+
assert not action.status
328328

329329
json_str = '{\"status\": \"true\"}'
330330
json_obj = json.loads(json_str)
331331
action.load_from_json(json_obj)
332-
assert action.status
332+
assert action.status
333333

334334
json_str = '{\"status\": \"invalid\"}'
335335
json_obj = json.loads(json_str)
@@ -428,7 +428,7 @@ class MockThermalManager(ThermalManagerBase):
428428

429429
with pytest.raises(Exception):
430430
MockThermalManager.load(os.path.join(test_path, 'policy_with_same_conditions.json'))
431-
431+
432432
def test_dynamic_minimum_table_data():
433433
from sonic_platform.device_data import DEVICE_DATA
434434
for platform, platform_data in DEVICE_DATA.items():
@@ -453,7 +453,7 @@ def check_minimum_table_data(platform, minimum_table):
453453
for item in data_list:
454454
cooling_level = item[0]
455455
range_str = item[1]
456-
456+
457457
ranges = range_str.split(':')
458458
low = int(ranges[0])
459459
high = int(ranges[1])

0 commit comments

Comments
 (0)