From b3d08c048bb35d915f0dd73e503a3afbcd1184c2 Mon Sep 17 00:00:00 2001 From: Andrei Machedon Date: Wed, 8 Oct 2025 13:21:30 +0300 Subject: [PATCH] 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 --- pyghmi/redfish/oem/lenovo/xcc3.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pyghmi/redfish/oem/lenovo/xcc3.py b/pyghmi/redfish/oem/lenovo/xcc3.py index fc2f1944..f3c8966d 100644 --- a/pyghmi/redfish/oem/lenovo/xcc3.py +++ b/pyghmi/redfish/oem/lenovo/xcc3.py @@ -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'])