diff --git a/ironic/drivers/modules/redfish/boot.py b/ironic/drivers/modules/redfish/boot.py index 21aae30fe1..e145b19251 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') @@ -547,8 +549,6 @@ class RedfishVirtualMediaBoot(base.BootInterface): _('Cannot attach configdrive for node %s: no suitable ' 'virtual USB slot has been found') % node.uuid) - 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 9376c0be1c..110c1b7f6c 100644 --- a/ironic/tests/unit/drivers/modules/redfish/test_boot.py +++ b/ironic/tests/unit/drivers/modules/redfish/test_boot.py @@ -710,12 +710,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: @@ -730,6 +731,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 0000000000..b67f709ffa --- /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.