Check if PSU files exists when getting psu_voltage properties (#17042)
- Why I did it Error messages occured when trying to read PSU files on init: ERR pmon#psud: Failed to read from file /var/run/hw-management/power/psu1_volt_out2_capability - FileNotFoundError(2, 'No such file or directory') This can happen when the power cord is disconnected from the PSU, so some PSU files may be absent, e.g.: /var/run/hw-management/power/psu2_volt_out2 /var/run/hw-management/power/psu2_volt_out2_capability - How I did it Check if a file exists for a specific PSU parameter If not, return None so we can't read the PSU file any further - How to verify it Disconnect power cord from PSU and power supply from system Wait few minutes and then connect power supply to system without power cord Check logs for errors Signed-off-by: Oleksandra Bella <oleksandrab@nvidia.com>
This commit is contained in:
parent
c2aa77c438
commit
26bc08850b
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2019-2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
# Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
# Apache-2.0
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -440,7 +440,8 @@ class Psu(FixedPsu):
|
||||
The thresholds of voltage are not supported on all platforms.
|
||||
So we have to check capability first.
|
||||
"""
|
||||
if self.psu_voltage_capability and self.psu_voltage_max and self.get_powergood_status():
|
||||
if self.psu_voltage_capability and os.path.exists(self.psu_voltage_capability) and \
|
||||
self.psu_voltage_max and os.path.exists(self.psu_voltage_max) and self.get_powergood_status():
|
||||
capability = utils.read_str_from_file(self.psu_voltage_capability)
|
||||
if 'max' in capability:
|
||||
max_voltage = utils.read_int_from_file(self.psu_voltage_max, log_func=logger.log_info)
|
||||
@ -463,7 +464,8 @@ class Psu(FixedPsu):
|
||||
The thresholds of voltage are not supported on all platforms.
|
||||
So we have to check capability first.
|
||||
"""
|
||||
if self.psu_voltage_capability and self.psu_voltage_min and self.get_powergood_status():
|
||||
if self.psu_voltage_capability and os.path.exists(self.psu_voltage_capability) and \
|
||||
self.psu_voltage_min and os.path.exists(self.psu_voltage_min) and self.get_powergood_status():
|
||||
capability = utils.read_str_from_file(self.psu_voltage_capability)
|
||||
if 'min' in capability:
|
||||
min_voltage = utils.read_int_from_file(self.psu_voltage_min, log_func=logger.log_info)
|
||||
|
Loading…
Reference in New Issue
Block a user