2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-27 19:37:44 +00:00

Support upcoming XCC update API

Upcoming XCC firmware update has an additional step to support in
order to successfully perform an update.

Change-Id: I08e1fccd25d40b290bbd818bdb57ef74131e76f7
This commit is contained in:
Jarrod Johnson 2018-12-07 16:38:21 -05:00
parent 4f74d4c4f9
commit bff08bbe60

View File

@ -1,6 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2016-2017 Lenovo
# Copyright 2016-2018 Lenovo
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -1428,7 +1428,7 @@ class XCCClient(IMMClient):
rsp = self.wc.grab_json_response('/api/providers/fwupdate', json.dumps(
{'UPD_WebSetFileName': rsp['items'][0]['path']}))
if rsp['return'] == 25:
raise Exception('Temporory error validating update, try again')
raise Exception('Temporary error validating update, try again')
if rsp['return'] != 0:
raise Exception('Unexpected return to set filename: ' + repr(rsp))
progress({'phase': 'validating',
@ -1439,6 +1439,25 @@ class XCCClient(IMMClient):
raise Exception('Update image not intended for this system')
if rsp['return'] != 0:
raise Exception('Unexpected return to verify: ' + repr(rsp))
verifystatus = 0
while verifystatus != 1:
rsp = self.wc.grab_json_response(
'/api/providers/fwupdate',
json.dumps({'UPD_WebVerifyUploadFileStatus': 1}))
if rsp['return'] == 2:
# The XCC firmware predates the FileStatus api
break
if rsp['return'] != 0:
raise Exception(
'Unexpected return to verifystate: {0}'.format(repr(rsp)))
verifystatus = rsp['status']
if verifystatus == 2:
raise Exception('Failed to verify firmware image')
if verifystatus != 1:
ipmisession.Session.pause(1)
if verifystatus not in (0, 255):
raise Exception(
'Unexpected reply to verifystate: ' + repr(rsp))
progress({'phase': 'validating',
'progress': 99.0})
self._refresh_token()