From 966c8709f846d040ca8dcada96b6554791e8d0b5 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 14 Jun 2022 12:12:22 -0400 Subject: [PATCH] Fix handling of 'blocked' slots in FPC FPCs represent blocked slots in a peculiar way, as a node that is in 'standby'. Avoid explicitly considering the power permission state of the permission state is standby. Change-Id: I801165e3e45fe1e4b7a8f7b4bc19b4ef9bee763f --- pyghmi/ipmi/oem/lenovo/nextscale.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/nextscale.py b/pyghmi/ipmi/oem/lenovo/nextscale.py index 02a1de16..e015a5a5 100644 --- a/pyghmi/ipmi/oem/lenovo/nextscale.py +++ b/pyghmi/ipmi/oem/lenovo/nextscale.py @@ -152,22 +152,23 @@ def fpc_get_nodeperm(ipmicmd, number, sz): rsp['data'] = b'\x00' + bytes(rsp['data']) elif len(rsp['data']) == 6: # New FPC format rsp['data'] = bytes(rsp['data'][:2]) + bytes(rsp['data'][3:]) - perminfo = bytearray(rsp['data'])[1] + permdata = bytearray(rsp['data']) + perminfo = permdata[1] if sz == 6: # FPC - permfail = ('\x02', '\x03') + permfail = (2, 3) else: # SMM - permfail = ('\x02',) + permfail = (2,) if perminfo & 0x20: - if rsp['data'][4] in permfail: + if permdata[4] in permfail: states.append('Insufficient Power') health = pygconst.Health.Failed - elif rsp['data'][3:5] != '\x00\x00': + elif rsp['data'][3:5] != '\x00\x00' and permdata[4] not in (0, 1): states.append('No Power Permission') health = pygconst.Health.Failed if perminfo & 0x40: states.append('Node Fault') health = pygconst.Health.Failed - if rsp['data'][3:5] == '\x00\x00': + if rsp['data'][3:5] == '\x00\x00' or permdata[4] == 0: states.append('Absent') return (health, states)