2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-31 05:17:39 +00:00

Improve robustness of IPMI config for XMM/XCC

Request more forgiving timing for the write filehandle,
and also do not raise error on closing a purged filehandle.

Change-Id: I2a8274f5e2e5b651d8b062433030e75a2bd608eb
This commit is contained in:
Jarrod Johnson 2021-01-27 13:15:33 -05:00
parent 3a27b3b7fa
commit 9251418f56

View File

@ -165,7 +165,7 @@ class LenovoFirmwareConfig(object):
data.extend(OPEN_WO_COMMAND)
hex_size = struct.pack("<I", size)
data.extend(bytearray(hex_size[:4]))
data.extend([0x01, 0x10])
data.extend([0x01, 0x40])
if not isinstance(filename, bytes):
filename = filename.encode('utf-8')
data.extend(filename)
@ -192,7 +192,11 @@ class LenovoFirmwareConfig(object):
hex_filehandle = struct.pack("<I", filehandle)
data.extend(bytearray(hex_filehandle[:4]))
run_command_with_retry(self.connection, data=data)
try:
run_command_with_retry(self.connection, data=data)
except pygexc.IpmiException as e:
if e.ipmicode != 203:
raise
def imm_write(self, filehandle, size, inputdata):
blocksize = 0xc8