2
0
mirror of https://opendev.org/x/pyghmi synced 2026-01-10 18:22:32 +00:00

Make storage layer information retrieval a bit more robust

- Sometimes, probably because of FW version, controllers do not have
  'LocationType' key and it can be retrieved also from 'ServiceLabel'
key which usually exists
- Standardize VROC controller by associating slot id 0 to it
- Do not consider 'Direct attached NVME' drives as available for any
  RAID creation

Change-Id: I9edecc846283c64bbcfca18b983e9276795ccec6
This commit is contained in:
Andrei Machedon
2025-10-08 13:21:30 +03:00
parent 984e7859a7
commit b3d08c048b

View File

@@ -128,7 +128,9 @@ class OEMHandler(generic.OEMHandler):
anames = {}
for adata, _ in adapterdata:
skipadapter = False
clabel = adata['Slot']['Location']['PartLocation']['LocationType']
clabel = adata['Slot']['Location']['PartLocation'].get('LocationType','')
if not clabel:
clabel = adata['Slot']['Location']['PartLocation'].get('ServiceLabel', '').split("=")[0]
if clabel != 'Embedded':
aslot = adata['Slot']['Location']['PartLocation']['LocationOrdinalValue']
clabel = 'Slot {0}'.format(aslot)
@@ -240,10 +242,16 @@ class OEMHandler(generic.OEMHandler):
standalonedisks = []
pools = []
for item in rsp.get('Members',[]):
# Drives shown at 'Direct attached drives' in XCC
# cannot be used for RAID creation
if item['Id'].lower() == 'direct_attached_nvme':
continue
cdisks = [item['Drives'][i]['@odata.id'] for i in range(len(item['Drives']))]
cid = '{0},{1}'.format(
item['Id'],
item['StorageControllers'][0]['Location']['PartLocation'].get('LocationOrdinalValue', -1))
if item['Id'].lower() == 'vroc':
cid = 'vroc,0'
storage_pools = self._get_expanded_data(item['StoragePools']['@odata.id'])
for p in storage_pools['Members']:
vols = self._get_expanded_data(p['AllocatedVolumes']['@odata.id'])