[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:
Kevin(Shengkai) Wang 2018-10-12 23:32:39 +08:00 committed by lguohan
parent 5ab66b191a
commit cd1167d767
5 changed files with 40 additions and 17 deletions

View File

@ -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):
"""

View File

@ -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):
"""

View File

@ -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):
"""

View File

@ -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):
"""

View File

@ -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):
"""