2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-27 19:37:44 +00:00

Passthrough errors when not sent by BMC in MegaRAC

In the 'has_megarac' call, it erroneously was assumed that
any IpmiException reflected the BMC indicating explicitly that
it didn't understand something about the command.  However
IpmiException is frequently used without a code to indicate
some harder error that can't relate to a system return code.
Address this by raising the exception if it didn't have a
BMC error code initialized.  It may be possible to get even
more specific, but somewhat limited because we could be getting
a 'invalid command' or 'invalid command length' or some 0x80
neighborhood error code, some OEM response.  Fortunately
things are limited since this code should only ever fire
against Lenovo equipment, but still keeping things open ended.

Change-Id: Ia84d1474f7d6787d162c6c7ef448f269d826cc2a
This commit is contained in:
Jarrod Johnson 2016-04-25 09:28:41 -04:00
parent d0f51df896
commit 120d5f9a82

View File

@ -597,8 +597,12 @@ class OEMHandler(generic.OEMHandler):
# rsp should have a length of one, and be either '\x00' or '\x01'
if len(rsp['data'][:]) == 1 and rsp['data'][0] in ('\x00', '\x01'):
self._has_megarac = True
except pygexc.IpmiException:
pass # Means that it's not going to be a megarac
except pygexc.IpmiException as ie:
if ie.ipmicode == 0:
# if it's a generic IpmiException rather than an error code
# from the BMC, then this is a deeper problem than just an
# invalid command or command length or similar
raise
return self._has_megarac
def set_alert_ipv6_destination(self, ip, destination, channel):