From cf1f0c25e6048ff2179d053dcc222cd6f2ec3a86 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 7 Sep 2018 13:13:31 -0400 Subject: [PATCH] Add 'name' subfield to preserve original names. For inventory taking, the lack of common names for the same thing is a problem. Provide a 'name' field to preserve the original name that may be duplicate, but indicate multiple instances of the same thing. Change-Id: I02e9902f4c2d9d07982fd00b9a17617b96deb1ef --- pyghmi/ipmi/oem/lenovo/imm.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index d9690047..d0fc066a 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -586,12 +586,6 @@ class IMMClient(object): anames = {} for adata in adapterdata['items']: skipadapter = False - aname = adata[self.ADP_NAME] - if aname in anames: - anames[aname] += 1 - aname = '{0} {1}'.format(aname, anames[aname]) - else: - anames[aname] = 1 clabel = adata[self.ADP_LABEL] if clabel == 'Unknown': continue @@ -601,7 +595,13 @@ class IMMClient(object): clabel = 'ML2 (Slot {0})'.format(aslot) else: clabel = 'Slot {0}'.format(aslot) - bdata = {'location': clabel} + aname = adata[self.ADP_NAME] + bdata = {'location': clabel, 'name': aname} + if aname in anames: + anames[aname] += 1 + aname = '{0} {1}'.format(aname, anames[aname]) + else: + anames[aname] = 1 for fundata in adata[self.ADP_FUN]: bdata['pcislot'] = '{0:02x}:{1:02x}'.format( fundata[self.BUSNO], fundata[self.DEVNO])