2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-10-20 14:45:45 +00:00

Merge pull request #231 from Obihoernchen/ipmioemfix

Improve SEL record type handling in aiohmi
This commit is contained in:
Jarrod Johnson
2026-07-13 08:56:28 -04:00
committed by GitHub
2 changed files with 29 additions and 4 deletions
+26 -3
View File
@@ -519,15 +519,38 @@ class EventHandler(object):
selentry = bytearray(origselentry)
event = {}
event['record_id'] = struct.unpack_from('<H', origselentry[:2])[0]
if selentry[2] == 2 or (0xc0 <= selentry[2] <= 0xdf):
if selentry[2] < 0xe0 and len(selentry) >= 7:
# Either standard, or at least the timestamp is standard
event['timecode'] = struct.unpack_from('<I', buffer(selentry[3:7])
)[0]
if selentry[2] == 2: # ipmi defined standard format
self._decode_standard_event(selentry[7:], event)
if selentry[2] < 0xc0:
# ipmi defined standard format (0x02); like ipmitool, extend the
# same treatment to reserved types some BMCs use (e.g. AMI 0x04)
try:
self._decode_standard_event(selentry[7:], event)
except Exception:
# a record body that does not actually follow the standard
# layout; discard any partially decoded fields and pass it
# through raw rather than aborting the fetch
for key in list(event):
if key not in ('record_id', 'timecode'):
del event[key]
event['oemdata'] = selentry[3:]
elif 0xc0 <= selentry[2] <= 0xdf:
event['oemid'] = selentry[7:10]
event['oemdata'] = selentry[10:]
elif selentry[2] == 0xf0:
# De facto standard from the Linux kernel ipmi panic logger,
# also recognized by ipmitool and freeipmi: byte 4 is a chunk
# sequence number and bytes 5-15 carry a piece of the panic
# string
event['event'] = 'Linux kernel panic: {0}'.format(
selentry[5:16].partition(b'\x00')[0].decode(
'utf-8', 'replace'))
event['severity'] = pygconst.Health.Critical
# this layout is defined by the kernel convention rather than
# the BMC vendor, so bypass the OEM handler
return event
elif selentry[2] >= 0xe0:
# In this class of OEM message, all bytes are OEM, interpretation
# is wholly left up to the OEM layer, using the OEM ID of the BMC
+3 -1
View File
@@ -143,7 +143,9 @@ class OEMHandler(object):
to apply some transform to some field to suit their conventions.
"""
event['oem_handler'] = None
evdata = event['event_data_bytes']
evdata = event.get('event_data_bytes')
if evdata is None:
return
if evdata[0] & 0b11000000 == 0b10000000:
event['oem_byte2'] = evdata[1]
if evdata[0] & 0b110000 == 0b100000: