2
0
mirror of https://opendev.org/x/pyghmi synced 2024-12-25 12:41:37 +00:00

Use approved method to determine XCC vintage

Use the model on the Manager instance to determine XCC 3 vs. prior generations.

Change-Id: I2c192d6d1842af9a512396769e56a42e1cef14a7
This commit is contained in:
Jarrod Johnson 2024-08-30 13:34:27 -04:00
parent 505a1d3d07
commit 9e47a44b93

View File

@ -20,13 +20,22 @@ from pyghmi.redfish.oem.lenovo import xcc3
def get_handler(sysinfo, sysurl, webclient, cache, cmd):
leninf = sysinfo.get('Oem', {}).get('Lenovo', {})
mgrinfo = {}
if leninf:
mgrinf, status = webclient.grab_json_response_with_status('/redfish/v1/Managers/1')
if status != 200:
mgrinfo = {}
if not leninf:
bmcinfo = cmd.bmcinfo
if 'Ami' in bmcinfo.get('Oem', {}):
return tsma.TsmHandler(sysinfo, sysurl, webclient, cache)
elif 'NextOneTimeBootDevice' in leninf:
return xcc3.OEMHandler(sysinfo, sysurl, webclient, cache,
gpool=cmd._gpool)
elif 'xclarity controller' in mgrinf.get('Model', '').lower():
if mgrinf['Model'].endswith('3'):
return xcc3.OEMHandler(sysinfo, sysurl, webclient, cache,
gpool=cmd._gpool)
else:
return xcc.OEMHandler(sysinfo, sysurl, webclient, cache,
gpool=cmd._gpool)
elif 'FrontPanelUSB' in leninf or 'USBManagementPortAssignment' in leninf or sysinfo.get('SKU', '').startswith('7X58'):
return xcc.OEMHandler(sysinfo, sysurl, webclient, cache,
gpool=cmd._gpool)