2
0
mirror of https://opendev.org/x/pyghmi synced 2025-08-21 10:30:19 +00:00

Revise the FPC fix

It turns out that the root cause for the behavior was subtly
different.  Update to handle the new formats.

Change-Id: I6dbc3793e377d24a6eae6fb97d592dc0813ddf07
This commit is contained in:
Jarrod Johnson
2018-04-13 11:13:19 -04:00
parent 053d8a8e88
commit 237cf886ac

View File

@@ -98,20 +98,25 @@ def fpc_get_nodeperm(ipmicmd, number, sz):
states = []
if len(rsp['data']) == 4: # different gens handled rc differently
rsp['data'] = b'\x00' + bytes(rsp['data'])
elif len(rsp['data']) == 6: # New FPC format
rsp['data'] = rsp['data'][:2] + rsp['data'][3:]
perminfo = ord(rsp['data'][1])
if sz == 6: # FPC
permfail = ('\x02', '\x03')
elif sz == 2: # SMM
permfail = ('\x02',)
if rsp['data'][4] in permfail:
states.append('Insufficient Power')
health = pygconst.Health.Failed
if perminfo & 0x20:
if rsp['data'][4] in permfail:
states.append('Insufficient Power')
health = pygconst.Health.Failed
elif rsp['data'][3:5] != '\x00\x00':
states.append('No Power Permission')
health = pygconst.Health.Failed
if perminfo & 0x40:
states.append('Node Fault')
health = pygconst.Health.Failed
if perminfo & 0x20:
states.append('No Power Permission')
health = pygconst.Health.Failed
if rsp['data'][3:5] == '\x00\x00':
states.append('Absent')
return (health, states)