2
0
mirror of https://opendev.org/x/pyghmi synced 2026-01-11 10:42:32 +00:00

Add facility to check update status

Firmware has mechanism to advertise the
health of the updateservice.  Provide this as a function.

Change-Id: Iaa1f2055bfea1eef3c8307a56a68098ce136fcb1
This commit is contained in:
Jarrod Johnson
2025-03-19 15:29:31 -04:00
parent 4e19aa985c
commit b8e6a1f8ae
6 changed files with 33 additions and 1 deletions

View File

@@ -2220,6 +2220,10 @@ class Command(object):
self.oem_init()
return self._oem.get_graphical_console()
def get_update_status(self):
self.oem_init()
return self._oem.get_update_status()
def update_firmware(self, filename, data=None, progress=None, bank=None):
"""Send file to BMC to perform firmware update

View File

@@ -339,6 +339,10 @@ class OEMHandler(object):
raise exc.UnsupportedFunctionality(
'Remote storage configuration not supported on this platform')
def get_update_status(self):
raise exc.UnsupportedFunctionality(
'Firmwore update not supported on this platform')
def update_firmware(self, filename, data=None, progress=None, bank=None):
raise exc.UnsupportedFunctionality(
'Firmware update not supported on this platform')

View File

@@ -1184,6 +1184,13 @@ class OEMHandler(generic.OEMHandler):
else:
raise
def get_update_status(self):
if self.is_fpc or self.has_tsma:
return "ready"
if self.has_xcc:
return self.immhandler.get_update_status()
return super(OEMHandler, self).get_update_status()
def update_firmware(self, filename, data=None, progress=None, bank=None):
if self.has_xcc:
return self.immhandler.update_firmware(

View File

@@ -2128,7 +2128,14 @@ class XCCClient(IMMClient):
def set_custom_user_privilege(self, uid, privilege):
return self.set_user_access(self, uid, privilege)
def get_update_status(self):
upd = self.grab_redfish_response_emptyonerror('/redfish/v1/UpdateService')
health = upd.get('Status', {}).get('Health', 'bod')
if health == 'OK':
return 'ready'
return 'unavailable'
def update_firmware(self, filename, data=None, progress=None, bank=None):
usd = self.grab_redfish_response_emptyonerror(
'/redfish/v1/UpdateService')

View File

@@ -1473,6 +1473,9 @@ class Command(object):
"""
return self.oem.upload_media(filename, progress, data)
def get_update_status(self):
return self.oem.get_update_status()
def update_firmware(self, file, data=None, progress=None, bank=None):
"""Send file to BMC to perform firmware update

View File

@@ -1047,6 +1047,13 @@ class OEMHandler(object):
raise exc.UnsupportedFunctionality(
'Remote media upload not supported on this platform')
def get_update_status(self):
upd = self._do_web_request('/redfish/v1/UpdateService')
health = upd.get('Status', {}).get('Health', 'bad')
if health == 'OK':
return 'ready'
return 'unavailable'
def update_firmware(self, filename, data=None, progress=None, bank=None, otherfields=()):
# disable cache to make sure we trigger the token renewal logic if needed
usd = self._do_web_request('/redfish/v1/UpdateService', cache=False)