2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-14 11:48:33 +00:00

Request forced inventory after adapter update

For adapter firmware to be accurate, force an inventory
boot on next reboot.

Change-Id: I9d0281de1bd8c39ec79aace5f8b4343b97ffe89b
This commit is contained in:
Jarrod Johnson 2019-03-07 14:42:10 -05:00
parent db1a87f7b1
commit 4ff8bc7cc0

View File

@ -260,6 +260,21 @@ class IMMClient(object):
self.fwo = None
raise
def set_property(self, propname, value):
if not isinstance(value, int) or value > 255:
raise Exception('Unsupported property value')
propname = propname.encode('utf-8')
proplen = len(propname) | 0b10000000
valuelen = 0x11
cmdlen = len(propname) + len(valuelen) + 3
cdata = bytearray([3, 0, cmdlen, 1, proplen]) + propname
cdata += bytearray([valuelen, value])
rsp = self.ipmicmd.xraw_command(netfn=0x3a, command=0xc4, data=cdata)
rsp['data'] = bytearray(rsp['data'])
if rsp['data'][0] != 0:
raise Exception('Unknown response setting property: {0}'.format(
rsp['data'][0]))
def get_property(self, propname):
propname = propname.encode('utf-8')
proplen = len(propname) | 0b10000000
@ -1577,6 +1592,7 @@ class XCCClient(IMMClient):
errmsg = repr(rsp) if rsp else self.wc.lastjsonerror
raise Exception(
'Unexpected result from PCI select: ' + errmsg)
self.set_property('/v2/ibmc/uefi/force-inventory', 1)
else:
rsp = self.wc.grab_json_response(
'/api/dataset/imm_firmware_update')