diff --git a/pyghmi/ipmi/oem/lenovo/nextscale.py b/pyghmi/ipmi/oem/lenovo/nextscale.py index a84144cf..726798bd 100644 --- a/pyghmi/ipmi/oem/lenovo/nextscale.py +++ b/pyghmi/ipmi/oem/lenovo/nextscale.py @@ -483,6 +483,66 @@ class SMMClient(object): 'delivery is at the sustained capacity of the remaining ' 'supplies.') } + try: + numbays = 12 + try: + chassiscapinfo = self.ipmicmd.xraw_command( + 0x32, 0x9d, data=[13]) + except pygexc.IpmiException as e: + if e.ipmicode == 201: # this must be a 2U + numbays = 4 + chassiscapinfo = self.ipmicmd.xraw_command( + 0x32, 0x9d, data=[5]) + else: + raise + retoffset = 0 + if len(chassiscapinfo['data']) > 10: + retoffset = 1 + chassiscapstate = self.ipmicmd.xraw_command( + 0x32, 0xa0, data=[numbays + 1]) + capstate = bool(chassiscapstate['data'][retoffset]) + capmin, capmax, protcap, usercap, thermcap = struct.unpack( + '