[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
This commit is contained in:
parent
fa0ae42e69
commit
e4ff4d2e3a
@ -45,7 +45,7 @@ class FanInfo(ThermalPolicyInfoBase):
|
|||||||
elif status and fan in self._fault_fans:
|
elif status and fan in self._fault_fans:
|
||||||
self._fault_fans.remove(fan)
|
self._fault_fans.remove(fan)
|
||||||
self._status_changed = True
|
self._status_changed = True
|
||||||
|
|
||||||
|
|
||||||
def get_absence_fans(self):
|
def get_absence_fans(self):
|
||||||
"""
|
"""
|
||||||
@ -96,12 +96,12 @@ class PsuInfo(ThermalPolicyInfoBase):
|
|||||||
"""
|
"""
|
||||||
self._status_changed = False
|
self._status_changed = False
|
||||||
for psu in chassis.get_all_psus():
|
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._presence_psus.add(psu)
|
||||||
self._status_changed = True
|
self._status_changed = True
|
||||||
if psu in self._absence_psus:
|
if psu in self._absence_psus:
|
||||||
self._absence_psus.remove(psu)
|
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._absence_psus.add(psu)
|
||||||
self._status_changed = True
|
self._status_changed = True
|
||||||
if psu in self._presence_psus:
|
if psu in self._presence_psus:
|
||||||
|
@ -81,9 +81,9 @@ def test_psu_info():
|
|||||||
|
|
||||||
psu_list[0].powergood = False
|
psu_list[0].powergood = False
|
||||||
psu_info.collect(chassis)
|
psu_info.collect(chassis)
|
||||||
assert len(psu_info.get_absence_psus()) == 1
|
assert len(psu_info.get_absence_psus()) == 0
|
||||||
assert len(psu_info.get_presence_psus()) == 0
|
assert len(psu_info.get_presence_psus()) == 1
|
||||||
assert psu_info.is_status_changed()
|
assert not psu_info.is_status_changed()
|
||||||
|
|
||||||
|
|
||||||
def test_fan_policy(thermal_manager):
|
def test_fan_policy(thermal_manager):
|
||||||
@ -324,12 +324,12 @@ def test_load_control_thermal_algo_action():
|
|||||||
json_str = '{\"status\": \"false\"}'
|
json_str = '{\"status\": \"false\"}'
|
||||||
json_obj = json.loads(json_str)
|
json_obj = json.loads(json_str)
|
||||||
action.load_from_json(json_obj)
|
action.load_from_json(json_obj)
|
||||||
assert not action.status
|
assert not action.status
|
||||||
|
|
||||||
json_str = '{\"status\": \"true\"}'
|
json_str = '{\"status\": \"true\"}'
|
||||||
json_obj = json.loads(json_str)
|
json_obj = json.loads(json_str)
|
||||||
action.load_from_json(json_obj)
|
action.load_from_json(json_obj)
|
||||||
assert action.status
|
assert action.status
|
||||||
|
|
||||||
json_str = '{\"status\": \"invalid\"}'
|
json_str = '{\"status\": \"invalid\"}'
|
||||||
json_obj = json.loads(json_str)
|
json_obj = json.loads(json_str)
|
||||||
@ -428,7 +428,7 @@ def test_load_policy_with_same_conditions():
|
|||||||
|
|
||||||
with pytest.raises(Exception):
|
with pytest.raises(Exception):
|
||||||
MockThermalManager.load(os.path.join(test_path, 'policy_with_same_conditions.json'))
|
MockThermalManager.load(os.path.join(test_path, 'policy_with_same_conditions.json'))
|
||||||
|
|
||||||
def test_dynamic_minimum_table_data():
|
def test_dynamic_minimum_table_data():
|
||||||
from sonic_platform.device_data import DEVICE_DATA
|
from sonic_platform.device_data import DEVICE_DATA
|
||||||
for platform, platform_data in DEVICE_DATA.items():
|
for platform, platform_data in DEVICE_DATA.items():
|
||||||
@ -453,7 +453,7 @@ def check_minimum_table_data(platform, minimum_table):
|
|||||||
for item in data_list:
|
for item in data_list:
|
||||||
cooling_level = item[0]
|
cooling_level = item[0]
|
||||||
range_str = item[1]
|
range_str = item[1]
|
||||||
|
|
||||||
ranges = range_str.split(':')
|
ranges = range_str.split(':')
|
||||||
low = int(ranges[0])
|
low = int(ranges[0])
|
||||||
high = int(ranges[1])
|
high = int(ranges[1])
|
||||||
|
Loading…
Reference in New Issue
Block a user