From 120d5f9a8215b9dfcf91e3ed024ea441196bf052 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 25 Apr 2016 09:28:41 -0400 Subject: [PATCH] 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 --- pyghmi/ipmi/oem/lenovo/handler.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/handler.py b/pyghmi/ipmi/oem/lenovo/handler.py index c34fb602..771fcd73 100755 --- a/pyghmi/ipmi/oem/lenovo/handler.py +++ b/pyghmi/ipmi/oem/lenovo/handler.py @@ -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):