diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index 506d21a1..a0224b9d 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -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()