Skip to content

Commit 2b4c8ee

Browse files
[Mellanox] Fan speed should not be 100% when PSU is powered off (#9258) (#9380)
Backport #9258 to 201911 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 Conflicts: platform/mellanox/mlnx-platform-api/sonic_platform/thermal_infos.py
1 parent 690f8e6 commit 2b4c8ee

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
@@ -44,7 +44,7 @@ def collect(self, chassis):
4444
elif status and fan in self._fault_fans:
4545
self._fault_fans.remove(fan)
4646
self._status_changed = True
47-
47+
4848

4949
def get_absence_fans(self):
5050
"""
@@ -95,12 +95,12 @@ def collect(self, chassis):
9595
"""
9696
self._status_changed = False
9797
for psu in chassis.get_all_psus():
98-
if psu.get_presence() and psu.get_powergood_status() and psu not in self._presence_psus:
98+
if psu.get_presence() and psu not in self._presence_psus:
9999
self._presence_psus.add(psu)
100100
self._status_changed = True
101101
if psu in self._absence_psus:
102102
self._absence_psus.remove(psu)
103-
elif (not psu.get_presence() or not psu.get_powergood_status()) and psu not in self._absence_psus:
103+
elif (not psu.get_presence()) and psu not in self._absence_psus:
104104
self._absence_psus.add(psu)
105105
self._status_changed = True
106106
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):
@@ -304,12 +304,12 @@ def test_load_control_thermal_algo_action():
304304
json_str = '{\"status\": \"false\"}'
305305
json_obj = json.loads(json_str)
306306
action.load_from_json(json_obj)
307-
assert not action.status
307+
assert not action.status
308308

309309
json_str = '{\"status\": \"true\"}'
310310
json_obj = json.loads(json_str)
311311
action.load_from_json(json_obj)
312-
assert action.status
312+
assert action.status
313313

314314
json_str = '{\"status\": \"invalid\"}'
315315
json_obj = json.loads(json_str)
@@ -407,7 +407,7 @@ class MockThermalManager(ThermalManagerBase):
407407

408408
with pytest.raises(Exception):
409409
MockThermalManager.load(os.path.join(test_path, 'policy_with_same_conditions.json'))
410-
410+
411411
def test_dynamic_minimum_table_data():
412412
from sonic_platform.device_data import DEVICE_DATA
413413
for platform, platform_data in DEVICE_DATA.items():
@@ -432,7 +432,7 @@ def check_minimum_table_data(platform, minimum_table):
432432
for item in data_list:
433433
cooling_level = item[0]
434434
range_str = item[1]
435-
435+
436436
ranges = range_str.split(':')
437437
low = int(ranges[0])
438438
high = int(ranges[1])

0 commit comments

Comments
 (0)