[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
This commit is contained in:
Junchao-Mellanox 2021-12-08 10:22:51 +08:00 committed by GitHub
parent 690f8e6919
commit 2b4c8ee330
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View File

@ -95,12 +95,12 @@ class PsuInfo(ThermalPolicyInfoBase):
"""
self._status_changed = False
for psu in chassis.get_all_psus():
if psu.get_presence() and psu.get_powergood_status() and psu not in self._presence_psus:
if psu.get_presence() and psu not in self._presence_psus:
self._presence_psus.add(psu)
self._status_changed = True
if psu in self._absence_psus:
self._absence_psus.remove(psu)
elif (not psu.get_presence() or not psu.get_powergood_status()) and psu not in self._absence_psus:
elif (not psu.get_presence()) and psu not in self._absence_psus:
self._absence_psus.add(psu)
self._status_changed = True
if psu in self._presence_psus:

View File

@ -81,9 +81,9 @@ def test_psu_info():
psu_list[0].powergood = False
psu_info.collect(chassis)
assert len(psu_info.get_absence_psus()) == 1
assert len(psu_info.get_presence_psus()) == 0
assert psu_info.is_status_changed()
assert len(psu_info.get_absence_psus()) == 0
assert len(psu_info.get_presence_psus()) == 1
assert not psu_info.is_status_changed()
def test_fan_policy(thermal_manager):