2
0
mirror of https://opendev.org/x/pyghmi synced 2026-04-01 15:53:32 +00:00

Show LXPM bundle information for TSM

When used as IPMI oem handler, extend the
LXPM info since that is available through
IPMI at least.

Change-Id: Ib3b52b31040ab35c2766f2bbedcc540ae1be0768
This commit is contained in:
Jarrod Johnson
2021-03-12 14:06:19 -05:00
parent 24b3d61a40
commit f42d75ea9d
2 changed files with 22 additions and 3 deletions

View File

@@ -652,8 +652,8 @@ class OEMHandler(generic.OEMHandler):
return nextscale.get_fpc_firmware(bmcver, self.ipmicmd,
self._fpc_variant)
elif self.has_tsma:
return self.tsmahandler.get_firmware_inventory(components,
raisebypass=False)
return self.tsmahandler.get_firmware_inventory(
components, raisebypass=False, ipmicmd=self.ipmicmd)
return super(OEMHandler, self).get_oem_firmware(bmcver, components)
def get_diagnostic_data(self, savefile, progress, autosuffix=False):

View File

@@ -35,6 +35,17 @@ class HpmSection(object):
'hash_size', 'combo_image']
def cstr_to_str(cstr):
try:
endidx = cstr.index(b'\x00')
cstr = cstr[:endidx]
except Exception:
pass
if not isinstance(cstr, str):
cstr = cstr.decode('utf8')
return cstr
def read_hpm(filename, data):
hpminfo = []
if data:
@@ -310,7 +321,8 @@ class TsmHandler(generic.OEMHandler):
if status != 200:
raise Exception(repr(rsp))
def get_firmware_inventory(self, components, raisebypass=True):
def get_firmware_inventory(self, components, raisebypass=True,
ipmicmd=None):
wc = self.wc
fwinf, status = wc.grab_json_response_with_status(
'/api/DeviceVersion')
@@ -344,6 +356,13 @@ class TsmHandler(generic.OEMHandler):
lxpmres['version'] = '{0}.{1:02x}'.format(
lxpminf['main'], subver)
yield ('LXPM', lxpmres)
if ipmicmd:
rsp = ipmicmd.xraw_command(0x3c, 0x40, data=(7, 2))
buildid = cstr_to_str(bytes(rsp['data']))
yield ('LXPM Windows Driver Bundle', {'build': buildid})
rsp = ipmicmd.xraw_command(0x3c, 0x40, data=(7, 3))
buildid = cstr_to_str(bytes(rsp['data']))
yield ('LXPM Linux Driver Bundle', {'build': buildid})
name = 'TSM'
fwinf, status = wc.grab_json_response_with_status('/api/get-sysfwinfo')
if status != 200: