2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-15 12:17:44 +00:00

Add custom OEM PSU Based Power Capping config

for Lenovo ThinkServers

Change-Id: I0ee2d42d3c066befe7abbf958df3952c1b43e0a6
This commit is contained in:
Juliana Motira 2015-09-03 08:49:49 -03:00
parent 658c59f885
commit 8dfc6c1a4d
3 changed files with 57 additions and 0 deletions

View File

@ -1548,3 +1548,19 @@ class Command(object):
"""
self.oem_init()
return self._oem.get_oem_firmware()
def get_capping_enabled(self):
"""Get PSU based power capping status
:return: True if enabled and False if disabled
"""
self.oem_init()
return self._oem.get_oem_capping_enabled()
def set_capping_enabled(self, enable):
"""Set PSU based power capping
:param enable: True for enable and False for disable
"""
self.oem_init()
return self._oem.set_oem_capping_enabled(enable)

View File

@ -127,3 +127,17 @@ class OEMHandler(object):
"""Get Firmware information.
"""
return ()
def get_oem_capping_enabled(self):
"""Get PSU based power capping status
:return: True if enabled and False if disabled
"""
return ()
def set_oem_capping_enabled(self, enable):
"""Set PSU based power capping
:param enable: True for enable and False for disable
"""
return ()

View File

@ -292,3 +292,30 @@ class OEMHandler(generic.OEMHandler):
command = firmware.get_categories()["firmware"]
rsp = self.ipmicmd.xraw_command(**command["command"])
return command["parser"](rsp["data"])
def get_oem_capping_enabled(self):
if self.has_tsm:
rsp = self.ipmicmd.xraw_command(netfn=0x3a, command=0x1b,
data=(3,))
# disabled
if rsp['data'][0] == '\x00':
return False
# enabled
else:
return True
def set_oem_capping_enabled(self, enable):
"""Set PSU based power capping
:param enable: True for enable and False for disable
"""
# 1 Enable power capping(default)
if enable:
statecode = 1
# 0 Disable power capping
else:
statecode = 0
if self.has_tsm:
self.ipmicmd.xraw_command(netfn=0x3a, command=0x1a,
data=(3, statecode))
return True