diff --git a/ironic/drivers/modules/image_utils.py b/ironic/drivers/modules/image_utils.py index 1320b15e04..105a57d152 100644 --- a/ironic/drivers/modules/image_utils.py +++ b/ironic/drivers/modules/image_utils.py @@ -345,7 +345,7 @@ def _prepare_iso_image(task, kernel_href, ramdisk_href, (kernel_params, ' '.join( '%s=%s' % kv for kv in params.items()))) - boot_mode = boot_mode_utils.get_boot_mode_for_deploy(task.node) + boot_mode = boot_mode_utils.get_boot_mode(task.node) LOG.debug("Trying to create %(boot_mode)s ISO image for node %(node)s " "with kernel %(kernel_href)s, ramdisk %(ramdisk_href)s, " diff --git a/ironic/tests/unit/drivers/modules/test_image_utils.py b/ironic/tests/unit/drivers/modules/test_image_utils.py index 54204995b5..e5dd94849a 100644 --- a/ironic/tests/unit/drivers/modules/test_image_utils.py +++ b/ironic/tests/unit/drivers/modules/test_image_utils.py @@ -259,6 +259,27 @@ class RedfishImageUtilsTestCase(db_base.DbTestCase): self.assertEqual(expected_url, url) + @mock.patch.object(image_utils.ImageHandler, 'publish_image', + autospec=True) + @mock.patch.object(images, 'create_boot_iso', autospec=True) + def test__prepare_iso_image_default_boot_mode( + self, mock_create_boot_iso, mock_publish_image): + self.config(default_boot_mode='uefi', group='deploy') + with task_manager.acquire(self.context, self.node.uuid, + shared=True) as task: + image_utils._prepare_iso_image( + task, 'http://kernel/img', 'http://ramdisk/img', + bootloader_href=None, root_uuid=task.node.uuid, + base_iso='/path/to/baseiso') + + mock_create_boot_iso.assert_called_once_with( + mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img', + boot_mode='uefi', esp_image_href=None, + configdrive_href=mock.ANY, + kernel_params='nofb nomodeset vga=normal', + root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123', + base_iso='/path/to/baseiso') + @mock.patch.object(image_utils.ImageHandler, 'publish_image', autospec=True) @mock.patch.object(images, 'create_boot_iso', autospec=True) @@ -282,7 +303,7 @@ class RedfishImageUtilsTestCase(db_base.DbTestCase): mock_create_boot_iso.assert_called_once_with( mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img', - boot_mode=None, esp_image_href=None, + boot_mode='bios', esp_image_href=None, configdrive_href=mock.ANY, kernel_params='nofb nomodeset vga=normal', root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123', @@ -308,7 +329,7 @@ class RedfishImageUtilsTestCase(db_base.DbTestCase): mock_create_boot_iso.assert_called_once_with( mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img', - boot_mode=None, esp_image_href=None, + boot_mode='bios', esp_image_href=None, configdrive_href=mock.ANY, kernel_params=kernel_params, root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123', diff --git a/releasenotes/notes/vmedia-boot-mode-f75c6fbef6349cbf.yaml b/releasenotes/notes/vmedia-boot-mode-f75c6fbef6349cbf.yaml new file mode 100644 index 0000000000..24d4b5fefb --- /dev/null +++ b/releasenotes/notes/vmedia-boot-mode-f75c6fbef6349cbf.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + The virtual media ISO image building process now respects the + ``default_boot_mode`` configuration option.