summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulia Kreger <juliaashleykreger@gmail.com>2020-11-12 06:56:10 -0800
committerDmitry Tantsur <dtantsur@protonmail.com>2020-12-19 19:03:16 +0000
commit4fb8163717e94468da08090ebfa8b137076d744a (patch)
tree81f6e8c630c42d6b189fd3ed43cbaf1f7cfbb59b
parent246e0cf29e0b14953efdca3952304cd652314d33 (diff)
downloadironic-python-agent-4fb8163717e94468da08090ebfa8b137076d744a.tar.gz
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
-rw-r--r--ironic_python_agent/extensions/standby.py2
-rw-r--r--ironic_python_agent/tests/unit/extensions/test_standby.py4
-rw-r--r--releasenotes/notes/fix-boot-mode-for-partition-images-f96cf2b3c27b6533.yaml7
3 files changed, 10 insertions, 3 deletions
diff --git a/ironic_python_agent/extensions/standby.py b/ironic_python_agent/extensions/standby.py
index e0ed1d6c..8d7c26c6 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 5fe7ca58..68b2c5d7 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 00000000..b3d23ccf
--- /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.