[mellanox]: Fix sysfs path for PSU devices in psuutil plugin (#2143)
Snmp container needs to access the PSU path, but /bsp doesn't mount into the container, so need to use the real path rather than a symlink. Signed-off-by: Kevin Wang <kevinw@mellanox.com>
This commit is contained in:
parent
5ab66b191a
commit
cd1167d767
@ -20,10 +20,14 @@ class PsuUtil(PsuBase):
|
||||
|
||||
def __init__(self):
|
||||
PsuBase.__init__(self)
|
||||
|
||||
self.psu_path = "/bsp/module/"
|
||||
self.psu_presence = "psu{}_pwr_status"
|
||||
self.psu_oper_status = "psu{}_pwr_status"
|
||||
self.psu_path = ""
|
||||
for index in range(0, 100):
|
||||
hwmon_path = "/sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon/hwmon{}/".format(index)
|
||||
if os.path.exists(hwmon_path):
|
||||
self.psu_path = hwmon_path
|
||||
break
|
||||
self.psu_presence = "pwr{}"
|
||||
self.psu_oper_status = "pwr{}"
|
||||
|
||||
def get_num_psus(self):
|
||||
"""
|
||||
|
@ -21,9 +21,14 @@ class PsuUtil(PsuBase):
|
||||
def __init__(self):
|
||||
PsuBase.__init__(self)
|
||||
|
||||
self.psu_path = "/bsp/module/"
|
||||
self.psu_presence = "psu{}_status"
|
||||
self.psu_oper_status = "psu{}_pwr_status"
|
||||
self.psu_path = ""
|
||||
for index in range(0, 100):
|
||||
hwmon_path = "/sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon/hwmon{}/".format(index)
|
||||
if os.path.exists(hwmon_path):
|
||||
self.psu_path = hwmon_path
|
||||
break
|
||||
self.psu_presence = "pwr{}"
|
||||
self.psu_oper_status = "pwr{}"
|
||||
|
||||
def get_num_psus(self):
|
||||
"""
|
||||
|
@ -21,9 +21,14 @@ class PsuUtil(PsuBase):
|
||||
def __init__(self):
|
||||
PsuBase.__init__(self)
|
||||
|
||||
self.psu_path = "/bsp/module/"
|
||||
self.psu_presence = "psu{}_status"
|
||||
self.psu_oper_status = "psu{}_pwr_status"
|
||||
self.psu_path = ""
|
||||
for index in range(0, 100):
|
||||
hwmon_path = "/sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon/hwmon{}/".format(index)
|
||||
if os.path.exists(hwmon_path):
|
||||
self.psu_path = hwmon_path
|
||||
break
|
||||
self.psu_presence = "psu{}"
|
||||
self.psu_oper_status = "pwr{}"
|
||||
|
||||
def get_num_psus(self):
|
||||
"""
|
||||
|
@ -21,9 +21,14 @@ class PsuUtil(PsuBase):
|
||||
def __init__(self):
|
||||
PsuBase.__init__(self)
|
||||
|
||||
self.psu_path = "/bsp/module/"
|
||||
self.psu_presence = "psu{}_status"
|
||||
self.psu_oper_status = "psu{}_pwr_status"
|
||||
self.psu_path = ""
|
||||
for index in range(0, 100):
|
||||
hwmon_path = "/sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon/hwmon{}/".format(index)
|
||||
if os.path.exists(hwmon_path):
|
||||
self.psu_path = hwmon_path
|
||||
break
|
||||
self.psu_presence = "psu{}"
|
||||
self.psu_oper_status = "pwr{}"
|
||||
|
||||
def get_num_psus(self):
|
||||
"""
|
||||
|
@ -20,10 +20,14 @@ class PsuUtil(PsuBase):
|
||||
|
||||
def __init__(self):
|
||||
PsuBase.__init__(self)
|
||||
|
||||
self.psu_path = "/bsp/module/"
|
||||
self.psu_presence = "psu{}_status"
|
||||
self.psu_oper_status = "psu{}_pwr_status"
|
||||
self.psu_path = ""
|
||||
for index in range(0, 100):
|
||||
hwmon_path = "/sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon/hwmon{}/".format(index)
|
||||
if os.path.exists(hwmon_path):
|
||||
self.psu_path = hwmon_path
|
||||
break
|
||||
self.psu_presence = "psu{}"
|
||||
self.psu_oper_status = "pwr{}"
|
||||
|
||||
def get_num_psus(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user