Fix boot mode detection for partition images

Previously, partition images were hard coded to be bios based
as opposed to consulting all of the values AND the node itself
before making the most appropriate determination. Now the agent
utilises the internal helper to properly determine the boot
mode when calling ironic-lib.

Story: 2008070
Task: 41265
Change-Id: Id5eeda69d5b9de2b393af414472d57b0d4380c43
This commit is contained in:
Julia Kreger 2020-11-12 06:56:10 -08:00 committed by Dmitry Tantsur
parent 246e0cf29e
commit 4fb8163717
3 changed files with 10 additions and 3 deletions

View File

@ -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']

View File

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

View File

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