2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-09-05 04:27:56 +00:00

Read health from a service that publishes no PCIe

PCIeDevices and PCIeFunctions are optional, and get_health indexed both
without checking. _get_adp_urls in the same file already spells it
.get('PCIeDevices', []), so these two were the outliers.

Power and cooling equipment has no PCIe at all. The KeyError escaped the
health read and reached the user as "Unexpected Error" with a traceback
behind it. Reproduces offline against DMTF's public-rackmount1 mockup.
This commit is contained in:
Markus Hilger
2026-09-01 23:51:32 +02:00
parent 7ba1798848
commit 5d5ad821f4
@@ -789,11 +789,14 @@ class OEMHandler(object):
meminfo = sysinfo['MemorySummary']
meminfo['Name'] = 'Memory'
summary['badreadings'].append(SensorReading(meminfo))
for adapter in sysinfo['PCIeDevices']:
# Both are optional in Redfish. A PDU or a cooling unit has no
# PCIe at all, and indexing them raised KeyError out of a health
# read.
for adapter in sysinfo.get('PCIeDevices', []):
adpinfo = await fishclient._do_web_request(adapter['@odata.id'])
if adpinfo['Status']['Health'] not in ('OK', None):
summary['badreadings'].append(SensorReading(adpinfo))
for fun in sysinfo['PCIeFunctions']:
for fun in sysinfo.get('PCIeFunctions', []):
funinfo = await fishclient._do_web_request(fun['@odata.id'])
if funinfo['Status']['Health'] not in ('OK', None):
summary['badreadings'].append(SensorReading(funinfo))