diff --git a/ironic_python_agent/extensions/standby.py b/ironic_python_agent/extensions/standby.py index e0ed1d6c9..8d7c26c68 100644 --- a/ironic_python_agent/extensions/standby.py +++ b/ironic_python_agent/extensions/standby.py @@ -160,7 +160,7 @@ def _write_partition_image(image, image_info, device): preserve_ep = image_info['preserve_ephemeral'] configdrive = image_info['configdrive'] boot_option = image_info.get('boot_option', 'local') - boot_mode = image_info.get('deploy_boot_mode', 'bios') + boot_mode = utils.get_node_boot_mode(cached_node) disk_label = utils.get_partition_table_type_from_specs(cached_node) root_mb = image_info['root_mb'] diff --git a/ironic_python_agent/tests/unit/extensions/test_standby.py b/ironic_python_agent/tests/unit/extensions/test_standby.py index 5fe7ca581..68b2c5d76 100644 --- a/ironic_python_agent/tests/unit/extensions/test_standby.py +++ b/ironic_python_agent/tests/unit/extensions/test_standby.py @@ -1364,6 +1364,7 @@ class TestStandbyExtension(base.IronicAgentTest): result = self.agent_extension.get_partition_uuids() self.assertEqual({'1': '2'}, result.serialize()['command_result']) + @mock.patch.object(utils, 'get_node_boot_mode', lambda self: 'uefi') @mock.patch.object(utils, 'get_partition_table_type_from_specs', lambda self: 'gpt') @mock.patch.object(hardware, 'dispatch_to_managers', autospec=True) @@ -1386,7 +1387,6 @@ class TestStandbyExtension(base.IronicAgentTest): node_uuid = image_info['node_uuid'] pr_ep = image_info['preserve_ephemeral'] configdrive = image_info['configdrive'] - boot_mode = image_info['deploy_boot_mode'] boot_option = image_info['boot_option'] cpu_arch = self.fake_cpu.architecture @@ -1408,7 +1408,7 @@ class TestStandbyExtension(base.IronicAgentTest): node_uuid, configdrive=configdrive, preserve_ephemeral=pr_ep, - boot_mode=boot_mode, + boot_mode='uefi', boot_option=boot_option, disk_label='gpt', cpu_arch=cpu_arch) diff --git a/releasenotes/notes/fix-boot-mode-for-partition-images-f96cf2b3c27b6533.yaml b/releasenotes/notes/fix-boot-mode-for-partition-images-f96cf2b3c27b6533.yaml new file mode 100644 index 000000000..b3d23ccf7 --- /dev/null +++ b/releasenotes/notes/fix-boot-mode-for-partition-images-f96cf2b3c27b6533.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Fixes issue where the running system operating mode was not taken into + account when writing partition images. The agent now utilises a helper + instead of explicitly expecting the flavor derived information to + supply all deployment context.