From 7ba12de874f2ff85db5fe332dffc9d8ff1d445a1 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 11 Jun 2015 14:33:12 -0400 Subject: [PATCH] Gather Thinkserver CPU and Memory independently If CPU inventory is unavalible, proceed to get memory inventory. If memory inventory is unavailable, cleanly omit the data. Change-Id: If9d5eec1aa5dcc7a2800e30636ff4cedee48a311 --- pyghmi/ipmi/oem/lenovo.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo.py b/pyghmi/ipmi/oem/lenovo.py index 16d51ebe..707d02de 100644 --- a/pyghmi/ipmi/oem/lenovo.py +++ b/pyghmi/ipmi/oem/lenovo.py @@ -223,22 +223,29 @@ class OEMHandler(generic.OEMHandler): def _collect_tsm_inventory(self): # Collect CPU inventory self.oem_inventory_info = {} + process_cpus = True try: rsp = self.ipmicmd.xraw_command(netfn=6, command=0x59, data=(0, 0xc1, 1, 0)) except pygexc.IpmiException: - return - compcount = ord(rsp['data'][1]) - for cpu in xrange(0, compcount): - offset = 2 + (85 * cpu) - self._decode_tsm_cpu(offset, rsp['data']) + process_cpus = False + if process_cpus: + compcount = ord(rsp['data'][1]) + for cpu in xrange(0, compcount): + offset = 2 + (85 * cpu) + self._decode_tsm_cpu(offset, rsp['data']) # Collect memory inventory - rsp = self.ipmicmd.xraw_command(netfn=6, command=0x59, - data=(0, 0xc1, 2, 0)) - compcount = ord(rsp['data'][1]) - for dimm in xrange(0, compcount): - offset = 2 + (dimm * 84) - self._decode_tsm_dimm(offset, rsp['data']) + process_memory = True + try: + rsp = self.ipmicmd.xraw_command(netfn=6, command=0x59, + data=(0, 0xc1, 2, 0)) + except pygexc.IpmiException: + process_memory = False + if process_memory: + compcount = ord(rsp['data'][1]) + for dimm in xrange(0, compcount): + offset = 2 + (dimm * 84) + self._decode_tsm_dimm(offset, rsp['data']) def process_fru(self, fru): if fru is None: