From 58fc21fc0b0ab7beb5a74654455265b95cc25a28 Mon Sep 17 00:00:00 2001 From: Riccardo Pittau Date: Wed, 3 Apr 2024 16:40:23 +0200 Subject: [PATCH] Fix redfish detach generic vmedia device method Fixes usage of redfish detach virtual media feature to be conform to the general implementation. Before the detach virtual media API call using redfish driver was not working as intended and caused the operation to fail. The method implementation was allowing only a single device_type while it should be multiple devices to match the conductor manager implementation. Change-Id: I9edd3b77eeb3ec1b0484d4e6f0c6dea53e83f9ad --- ironic/drivers/modules/redfish/management.py | 10 +++++++--- .../fix-detach-vmedia-redfish-c86b7d0f72217816.yaml | 7 +++++++ 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/fix-detach-vmedia-redfish-c86b7d0f72217816.yaml diff --git a/ironic/drivers/modules/redfish/management.py b/ironic/drivers/modules/redfish/management.py index 0037ff1dbd..64e2df002d 100644 --- a/ironic/drivers/modules/redfish/management.py +++ b/ironic/drivers/modules/redfish/management.py @@ -1349,13 +1349,17 @@ class RedfishManagement(base.ManagementInterface): redfish_boot.insert_vmedia(task, image_url, device_type) @task_manager.require_exclusive_lock - def detach_virtual_media(self, task, device_type=None): + def detach_virtual_media(self, task, device_types=None): """Detach some or all virtual media devices from the node. :param task: A task from TaskManager. - :param device_type: A device type from + :param device_types: A list of device types from :data:`ironic.common.boot_devices.VMEDIA_DEVICES`. If not provided, all devices are detached. """ - redfish_boot.eject_vmedia(task, device_type) + if device_types is None: + redfish_boot.eject_vmedia(task) + else: + for device_type in device_types: + redfish_boot.eject_vmedia(task, device_type) diff --git a/releasenotes/notes/fix-detach-vmedia-redfish-c86b7d0f72217816.yaml b/releasenotes/notes/fix-detach-vmedia-redfish-c86b7d0f72217816.yaml new file mode 100644 index 0000000000..f26da36c92 --- /dev/null +++ b/releasenotes/notes/fix-detach-vmedia-redfish-c86b7d0f72217816.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Fixes usage of redfish detach virtual media feature to be conform to + the general implementation. + Before the detach virtual media API call using redfish driver was not + working as intended and caused the operation to fail.