Redfish: Add MultipartHTTPPushUpdate (#6612)

* Redfish: Add MultipartHTTPPushUpdate

Signed-off-by: Mike Raineri <michael.raineri@dell.com>

* Updates based on CI results

Signed-off-by: Mike Raineri <michael.raineri@dell.com>

* Update plugins/modules/redfish_command.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update changelogs/fragments/6471-redfish-add-multipart-http-push-command.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/redfish_command.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/module_utils/redfish_utils.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/module_utils/redfish_utils.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/module_utils/redfish_utils.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/module_utils/redfish_utils.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Added missing import statement

Signed-off-by: Mike Raineri <michael.raineri@dell.com>

* Added documentation for the usage of 'timeout'

Signed-off-by: Mike Raineri <michael.raineri@dell.com>

---------

Signed-off-by: Mike Raineri <michael.raineri@dell.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Mike Raineri 2023-06-05 15:56:44 -04:00 committed by GitHub
parent 36e8653cf7
commit c4e7a943c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 161 additions and 3 deletions

View file

@ -137,6 +137,12 @@ options:
- URI of the image for the update.
type: str
version_added: '0.2.0'
update_image_file:
required: false
description:
- Filename, with optional path, of the image for the update.
type: path
version_added: '7.1.0'
update_protocol:
required: false
description:
@ -541,6 +547,30 @@ EXAMPLES = '''
username: operator
password: supersecretpwd
- name: Multipart HTTP push update; timeout is 600 seconds to allow for a
large image transfer
community.general.redfish_command:
category: Update
command: MultipartHTTPPushUpdate
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
timeout: 600
update_image_file: ~/images/myupdate.img
- name: Multipart HTTP push with additional options; timeout is 600 seconds
to allow for a large image transfer
community.general.redfish_command:
category: Update
command: MultipartHTTPPushUpdate
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
timeout: 600
update_image_file: ~/images/myupdate.img
update_targets:
- /redfish/v1/UpdateService/FirmwareInventory/BMC
- name: Perform requested operations to continue the update
community.general.redfish_command:
category: Update
@ -697,7 +727,7 @@ CATEGORY_COMMANDS_ALL = {
"Manager": ["GracefulRestart", "ClearLogs", "VirtualMediaInsert",
"VirtualMediaEject", "PowerOn", "PowerForceOff", "PowerForceRestart",
"PowerGracefulRestart", "PowerGracefulShutdown", "PowerReboot"],
"Update": ["SimpleUpdate", "PerformRequestedOperations"],
"Update": ["SimpleUpdate", "MultipartHTTPPushUpdate", "PerformRequestedOperations"],
}
@ -726,6 +756,7 @@ def main():
boot_override_mode=dict(choices=['Legacy', 'UEFI']),
resource_id=dict(),
update_image_uri=dict(),
update_image_file=dict(type='path'),
update_protocol=dict(),
update_targets=dict(type='list', elements='str', default=[]),
update_creds=dict(
@ -791,6 +822,7 @@ def main():
# update options
update_opts = {
'update_image_uri': module.params['update_image_uri'],
'update_image_file': module.params['update_image_file'],
'update_protocol': module.params['update_protocol'],
'update_targets': module.params['update_targets'],
'update_creds': module.params['update_creds'],
@ -940,6 +972,10 @@ def main():
result = rf_utils.simple_update(update_opts)
if 'update_status' in result:
return_values['update_status'] = result['update_status']
elif command == "MultipartHTTPPushUpdate":
result = rf_utils.multipath_http_push_update(update_opts)
if 'update_status' in result:
return_values['update_status'] = result['update_status']
elif command == "PerformRequestedOperations":
result = rf_utils.perform_requested_update_operations(update_opts['update_handle'])