mirror of
https://github.com/xcat2/confluent.git
synced 2026-09-02 07:26:04 +00:00
Read the lan config parameter through raw_command
pyghmi asks for this parameter with xraw_command and catches the completion code for a bmc that does not have it, and folding aiohmi in renamed that call to oldraw_command rather than raw_command, so the handler could no longer fire. Answering the code out of the returned dictionary repaired the crash but kept the call on the older contract, which is now the only one left in the tree. Catch it again instead: raw_command puts the completion code on the exception as ipmicode, and nothing here reads the payload of a reply that carries a code, which is the one thing catching gives up. No behaviour change, checked against the previous version over the same fake session for a good reply, an empty one, 0x80 and 0xC9 with and without a stray payload, four other completion codes, a timeout, a lost session and a reply with no data at all: same return value, same exception type, text and ipmicode, same bytes on the wire.
This commit is contained in:
@@ -824,20 +824,17 @@ class Command(object):
|
||||
async def _fetch_lancfg_data(self, channel, param, selector=0):
|
||||
"""Internal helper for fetching a lan cfg parameter's raw data
|
||||
|
||||
Answers None if the bmc does not have the parameter. Such a bmc says
|
||||
so in the completion code and sends no data at all, so the code has to
|
||||
be read before the payload is, and oldraw_command reports the code
|
||||
rather than raising on it, which is why this cannot be done by
|
||||
catching something.
|
||||
Answers None if the bmc does not have the parameter, which such a bmc
|
||||
reports in the completion code, sending no data at all.
|
||||
"""
|
||||
fetchcmd = bytearray((channel, param, selector, 0))
|
||||
fetched = await self.oldraw_command(0xc, 2, data=fetchcmd)
|
||||
if fetched['code'] in (0x80, 0xc9):
|
||||
try:
|
||||
fetched = await self.raw_command(0xc, 2, data=fetchcmd)
|
||||
except exc.IpmiException as ie:
|
||||
# parameter not supported, and parameter out of range
|
||||
return None
|
||||
if fetched['code']:
|
||||
raise exc.IpmiException(util.get_ipmi_error(fetched),
|
||||
fetched['code'])
|
||||
if ie.ipmicode in (0x80, 0xc9):
|
||||
return None
|
||||
raise
|
||||
return bytearray(fetched['data'])
|
||||
|
||||
async def _fetch_lancfg_param(self, channel, param, prefixlen=False):
|
||||
|
||||
Reference in New Issue
Block a user