summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ironic/drivers/modules/redfish/boot.py4
-rw-r--r--ironic/tests/unit/drivers/modules/redfish/test_boot.py4
-rw-r--r--releasenotes/notes/redfish-boot-mode-a44fc569f1baca8f.yaml5
3 files changed, 10 insertions, 3 deletions
diff --git a/ironic/drivers/modules/redfish/boot.py b/ironic/drivers/modules/redfish/boot.py
index 15c8352d1..3e7487fb8 100644
--- a/ironic/drivers/modules/redfish/boot.py
+++ b/ironic/drivers/modules/redfish/boot.py
@@ -505,6 +505,8 @@ class RedfishVirtualMediaBoot(base.BootInterface):
"""
node = task.node
+ boot_mode_utils.sync_boot_mode(task)
+
boot_option = deploy_utils.get_boot_option(node)
self.clean_up_instance(task)
iwdi = node.driver_internal_info.get('is_whole_disk_image')
@@ -536,8 +538,6 @@ class RedfishVirtualMediaBoot(base.BootInterface):
_eject_vmedia(task, sushy.VIRTUAL_MEDIA_CD)
_insert_vmedia(task, iso_ref, sushy.VIRTUAL_MEDIA_CD)
- boot_mode_utils.sync_boot_mode(task)
-
self._set_boot_device(task, boot_devices.CDROM, persistent=True)
LOG.debug("Node %(node)s is set to permanently boot from "
diff --git a/ironic/tests/unit/drivers/modules/redfish/test_boot.py b/ironic/tests/unit/drivers/modules/redfish/test_boot.py
index 540b99ceb..fb07cf639 100644
--- a/ironic/tests/unit/drivers/modules/redfish/test_boot.py
+++ b/ironic/tests/unit/drivers/modules/redfish/test_boot.py
@@ -700,12 +700,13 @@ class RedfishVirtualMediaBootTestCase(db_base.DbTestCase):
mock_boot_mode_utils.sync_boot_mode.assert_called_once_with(task)
+ @mock.patch.object(boot_mode_utils, 'sync_boot_mode', autospec=True)
@mock.patch.object(redfish_boot, '_eject_vmedia', autospec=True)
@mock.patch.object(image_utils, 'cleanup_iso_image', autospec=True)
@mock.patch.object(redfish_boot, 'manager_utils', autospec=True)
def _test_prepare_instance_local_boot(
self, mock_manager_utils,
- mock_cleanup_iso_image, mock__eject_vmedia):
+ mock_cleanup_iso_image, mock__eject_vmedia, mock_sync_boot_mode):
with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task:
@@ -720,6 +721,7 @@ class RedfishVirtualMediaBootTestCase(db_base.DbTestCase):
mock_cleanup_iso_image.assert_called_once_with(task)
mock__eject_vmedia.assert_called_once_with(
task, sushy.VIRTUAL_MEDIA_CD)
+ mock_sync_boot_mode.assert_called_once_with(task)
def test_prepare_instance_local_whole_disk_image(self):
self.node.driver_internal_info = {'is_whole_disk_image': True}
diff --git a/releasenotes/notes/redfish-boot-mode-a44fc569f1baca8f.yaml b/releasenotes/notes/redfish-boot-mode-a44fc569f1baca8f.yaml
new file mode 100644
index 000000000..b67f709ff
--- /dev/null
+++ b/releasenotes/notes/redfish-boot-mode-a44fc569f1baca8f.yaml
@@ -0,0 +1,5 @@
+---
+fixes:
+ - |
+ Boot mode is now correctly handled when using ``redfish-virtual-media``
+ boot with locally booted images.