From 700dd0c752e3b17991d4f2682ee79cc8d4f97125 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Sun, 24 Apr 2016 08:08:36 -0400 Subject: [PATCH] Change strategy to identify IMM Other Lenovo equipment uses the 'get build id' command. This switches to a facility more specifically designed to indicate what class of Lenovo service processor is in play. As a result, the firmware inventory function has to fend for itself. Change-Id: Id0354ebd4dbf57a0ff59860df663195b93adba1c --- pyghmi/ipmi/oem/lenovo/handler.py | 13 +++++-------- pyghmi/ipmi/oem/lenovo/imm.py | 5 +++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/handler.py b/pyghmi/ipmi/oem/lenovo/handler.py index 0003be4f..c34fb602 100755 --- a/pyghmi/ipmi/oem/lenovo/handler.py +++ b/pyghmi/ipmi/oem/lenovo/handler.py @@ -135,7 +135,6 @@ class OEMHandler(generic.OEMHandler): self.oem_inventory_info = None self._mrethidx = None self._hasimm = None - self._immbuildinfo = None @property def _megarac_eth_index(self): @@ -428,16 +427,15 @@ class OEMHandler(generic.OEMHandler): if self._hasimm is not None: return self._hasimm try: - bdata = self.ipmicmd.xraw_command(netfn=0x3a, command=0x50) + bdata = self.ipmicmd.xraw_command(netfn=0x3a, command=0xc1) except pygexc.IpmiException: self._hasimm = False return False - if len(bdata['data'][:]) != 30: + if len(bdata['data'][:]) != 3: self._hasimm = False return False - self._hasimm = True - self._immbuildinfo = bdata['data'][:] - return True + self._hasimm = ord(bdata['data'][1]) & 1 == 1 + return self._hasimm def get_oem_firmware(self, bmcver): if self.has_tsm: @@ -446,9 +444,8 @@ class OEMHandler(generic.OEMHandler): return command["parser"](rsp["data"]) elif self.has_imm: return imm.get_firmware_inventory(self.ipmicmd, bmcver, - self._immbuildinfo, self._certverify) - return () + return super(OEMHandler, self).get_oem_firmware(bmcver) def get_oem_capping_enabled(self): if self.has_tsm: diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index 34b48784..47d06be4 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -112,11 +112,12 @@ def fetch_adapter_firmware(wc): yield ('{0} {1}'.format(aname, fname), bdata) -def get_firmware_inventory(ipmicmd, bmcver, immbuildinfo, certverify): +def get_firmware_inventory(ipmicmd, bmcver, certverify): # First we fetch the system firmware found in imm properties # then check for agentless, if agentless, get adapter info using # https, using the caller TLS verification scheme - immverdata = parse_imm_buildinfo(immbuildinfo) + rsp = ipmicmd.xraw_command(netfn=0x3a, command=0x50) + immverdata = parse_imm_buildinfo(rsp['data']) bdata = {'version': bmcver, 'build': immverdata[0], 'date': immverdata[1]} yield ('IMM', bdata) bdata = fetch_grouped_properties(ipmicmd, {