diff options
author | Dmitry Tantsur <dtantsur@protonmail.com> | 2021-05-17 15:18:55 +0200 |
---|---|---|
committer | Dmitry Tantsur <dtantsur@protonmail.com> | 2021-05-17 16:12:30 +0200 |
commit | 2a73f5a84e06b370d0b04997cc0787497e111642 (patch) | |
tree | 4d3f0fcb9a4bebea1b09fdb33b499f3183d9f9ed /ironic/tests/unit/common/test_pxe_utils.py | |
parent | af94a3da1e3f66c70309bbb889c68dfc5bd67e9f (diff) | |
download | ironic-2a73f5a84e06b370d0b04997cc0787497e111642.tar.gz |
Clean up kernel_append_params for PXE/iPXE
Currently handling of kernel_append_params is very inconsistent. This
change applies a straightforward process:
1. instance_info[kernel_append_params]
2. driver_info[kernel_append_params]
3. [pxe]kernel_append_params (renamed from pxe_append_params).
Also adds a helper for subsequent fixes in other drivers.
Change-Id: I79bcf4d8ef1f0f55a82e0991dd5bb1685b3f7957
Story: #2008902
Task: #42469
Diffstat (limited to 'ironic/tests/unit/common/test_pxe_utils.py')
-rw-r--r-- | ironic/tests/unit/common/test_pxe_utils.py | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/ironic/tests/unit/common/test_pxe_utils.py b/ironic/tests/unit/common/test_pxe_utils.py index 1bd47192a..c1b38b5c9 100644 --- a/ironic/tests/unit/common/test_pxe_utils.py +++ b/ironic/tests/unit/common/test_pxe_utils.py @@ -1452,9 +1452,10 @@ class PXEBuildConfigOptionsTestCase(db_base.DbTestCase): def _test_build_pxe_config_options_pxe(self, render_mock, whle_dsk_img=False, debug=False, mode='deploy', - ramdisk_params=None): + ramdisk_params=None, + expected_pxe_params=None): self.config(debug=debug) - self.config(pxe_append_params='test_param', group='pxe') + self.config(kernel_append_params='test_param', group='pxe') driver_internal_info = self.node.driver_internal_info driver_internal_info['is_whole_disk_image'] = whle_dsk_img @@ -1498,7 +1499,8 @@ class PXEBuildConfigOptionsTestCase(db_base.DbTestCase): 'ramdisk')) }) - expected_pxe_params = 'test_param' + if expected_pxe_params is None: + expected_pxe_params = 'test_param' if debug: expected_pxe_params += ' ipa-debug=1' if ramdisk_params: @@ -1554,6 +1556,22 @@ class PXEBuildConfigOptionsTestCase(db_base.DbTestCase): self.node.save() self._test_build_pxe_config_options_pxe(whle_dsk_img=False) + def test_build_pxe_config_options_kernel_params_from_driver_info(self): + info = self.node.driver_info + info['kernel_append_params'] = 'params2' + self.node.driver_info = info + self.node.save() + self._test_build_pxe_config_options_pxe(whle_dsk_img=True, + expected_pxe_params='params2') + + def test_build_pxe_config_options_kernel_params_from_instance_info(self): + info = self.node.instance_info + info['kernel_append_params'] = 'params2' + self.node.instance_info = info + self.node.save() + self._test_build_pxe_config_options_pxe(whle_dsk_img=True, + expected_pxe_params='params2') + def test_build_pxe_config_options_ramdisk_params(self): self._test_build_pxe_config_options_pxe(whle_dsk_img=True, ramdisk_params={'foo': 'bar'}) @@ -1562,7 +1580,7 @@ class PXEBuildConfigOptionsTestCase(db_base.DbTestCase): del self.node.driver_internal_info['is_whole_disk_image'] self.node.save() pxe_params = 'my-pxe-append-params ipa-debug=0' - self.config(group='pxe', pxe_append_params=pxe_params) + self.config(group='pxe', kernel_append_params=pxe_params) self.config(group='pxe', tftp_server='my-tftp-server') self.config(group='pxe', tftp_root='/tftp-path/') image_info = { @@ -1717,7 +1735,7 @@ class iPXEBuildConfigOptionsTestCase(db_base.DbTestCase): iso_boot=False, multipath=False): self.config(debug=debug) - self.config(pxe_append_params='test_param', group='pxe') + self.config(kernel_append_params='test_param', group='pxe') self.config(ipxe_timeout=ipxe_timeout, group='pxe') root_dir = CONF.deploy.http_root |