2
0
mirror of https://opendev.org/x/pyghmi synced 2025-04-13 08:48:38 +00:00

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
This commit is contained in:
Jarrod Johnson 2018-09-07 13:13:31 -04:00
parent c87bdf7cef
commit cf1f0c25e6

View File

@ -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])