From d756743f40a8af058d6eb9a43972dd030ff874a1 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 15 Mar 2018 14:18:37 -0400 Subject: [PATCH] Get additional enclosure data Newer firmware provides more data about the enclosure. Use this to expand the details on the Enclosure inventory data. Change-Id: I022934e89ae3dc109d7f94da617127c2695b98c7 --- pyghmi/ipmi/oem/lenovo/imm.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index f524aa27..93787b0c 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -44,6 +44,11 @@ def fixup_uuid(uuidprop): return '-'.join(uuid).upper() +def fixup_str(propstr): + return ''.join([chr(int(c, 16)) for c in propstr.split()]).strip( + ' \xff\x00') + + class FileUploader(threading.Thread): def __init__(self, webclient, url, filename, data): @@ -425,9 +430,13 @@ class IMMClient(object): enclosureuuid = self.get_property('/v2/ibmc/smm/chassis/uuid') if enclosureuuid: bay = self.get_property('/v2/cmm/sp/7') + serial = self.get_property('/v2/ibmc/smm/chassis/sn') + model = self.get_property('/v2/ibmc/smm/chassis/mtm') hwmap['Enclosure'] = { 'UUID': fixup_uuid(enclosureuuid), 'Bay': bay, + 'Model': fixup_str(model), + 'Serial': fixup_str(serial), } adapterdata = self.get_cached_data('lenovo_cached_adapters') if not adapterdata: