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
(cherry picked from commit 58fc21fc0b)
This commit is contained in:
Riccardo Pittau 2024-04-03 16:40:23 +02:00
parent 22666a889f
commit d31ea3d051
2 changed files with 14 additions and 3 deletions

View File

@ -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)

View File

@ -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.