From 6d9a4b98d802b39f85119262c71a40bd51affa2b Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 23 Jan 2019 10:24:38 -0500 Subject: [PATCH] Ensure XCC health sets general level In the event of an event that is not modeled by the IPMI sensors, make sure that at least the health summary is correct. Add in a known condition that is missed by IPMI sensor modeling for detail as well. Change-Id: I207e137c49b4321cf4040188a84de569f55c5707 --- pyghmi/ipmi/oem/lenovo/imm.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index f0c09b56..f5f0cfe6 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -1603,6 +1603,25 @@ class XCCClient(IMMClient): if 'items' in rsp and len(rsp['items']) == 0: # The XCC reports healthy, no need to interrogate raise pygexc.BypassGenericBehavior() + for item in rsp['items']: + # while usually the ipmi interrogation shall explain things, + # just in case there is a gap, make sure at least the + # health field is accurately updated + if (item['severity'] == 'W' and + summary['health'] < pygconst.Health.Warning): + summary['health'] = pygconst.Health.Warning + if (item['severity'] == 'E' and + summary['health'] < pygconst.Health.Critical): + summary['health'] = pygconst.Health.Critical + if item['cmnid'] == 'FQXSPPW0104J': + # This event does not get modeled by the sensors + # add a made up sensor to explain + summary['badreadings'].append( + sdr.SensorReading({'name': item['source'], + 'states': ['Not Redundant'], + 'state_ids': [3], + 'health': pygconst.Health.Warning, + 'type': 'Power'}, '')) # Will use the generic handling for unhealthy systems def get_licenses(self):