summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2021-05-19 11:33:59 +0000
committerGerrit Code Review <review@openstack.org>2021-05-19 11:33:59 +0000
commitdb200f98800bf9d5831dae0d6fc1ba7f29d95e59 (patch)
treed094281b76e7b36a818c6e848803ebb12b8e9037
parent6c7d5e2626518b324c54e7bf594b81557d820728 (diff)
parent722326f6751d37302c4ece5849c827e7cc4dd14e (diff)
downloadironic-db200f98800bf9d5831dae0d6fc1ba7f29d95e59.tar.gz
Merge "Clean up kernel_append_params for iRMC"
-rw-r--r--ironic/conf/irmc.py10
-rw-r--r--ironic/drivers/modules/irmc/boot.py19
-rw-r--r--ironic/tests/unit/drivers/modules/irmc/test_boot.py87
-rw-r--r--releasenotes/notes/irmc-append-params-380a281db43e6013.yaml11
4 files changed, 115 insertions, 12 deletions
diff --git a/ironic/conf/irmc.py b/ironic/conf/irmc.py
index 5351d48c8..839c9c27e 100644
--- a/ironic/conf/irmc.py
+++ b/ironic/conf/irmc.py
@@ -106,6 +106,16 @@ opts = [
'configuration was successfully finished or not. '
'Foreground Initialization (FGI) will start 5 minutes '
'after creating virtual drives.')),
+ cfg.StrOpt('kernel_append_params',
+ # TODO(dtantsur): set to the same value as in [pxe] after Xena
+ default=None,
+ mutable=True,
+ help=_('Additional kernel parameters to pass down to the '
+ 'instance kernel. These parameters can be consumed by '
+ 'the kernel or by the applications by reading '
+ '/proc/cmdline. Mind severe cmdline size limit! Can be '
+ 'overridden by `instance_info/kernel_append_params` '
+ 'property.')),
]
diff --git a/ironic/drivers/modules/irmc/boot.py b/ironic/drivers/modules/irmc/boot.py
index 77244bda7..55ccf7587 100644
--- a/ironic/drivers/modules/irmc/boot.py
+++ b/ironic/drivers/modules/irmc/boot.py
@@ -81,6 +81,13 @@ OPTIONAL_PROPERTIES = {
"the IPv4 subnet mask that the storage network is configured to "
"utilize, in a range between 1 and 31 inclusive. This is necessary "
"for booting a node from a remote iSCSI volume. Optional."),
+ 'kernel_append_params': _("Additional kernel parameters to pass down to "
+ "instance kernel. These parameters can be "
+ "consumed by the kernel or by the applications "
+ "by reading /proc/cmdline. Mind severe cmdline "
+ "size limit. Overrides "
+ "[irmc]/kernel_append_params ironic "
+ "option."),
}
COMMON_PROPERTIES = REQUIRED_PROPERTIES.copy()
@@ -164,6 +171,15 @@ def _parse_driver_info(node, mode='deploy'):
'node': node.uuid})
raise exception.InvalidParameterValue(msg)
+ kernel_params = driver_utils.get_kernel_append_params(
+ node, default=CONF.irmc.kernel_append_params)
+ if kernel_params is None:
+ LOG.warning('Relying on [pxe]kernel_append_params in the iRMC '
+ 'hardware type is deprecated, please set '
+ '[irmc]kernel_append_params')
+ kernel_params = CONF.pxe.kernel_append_params
+ deploy_info['kernel_append_params'] = kernel_params
+
return deploy_info
@@ -308,8 +324,7 @@ def _prepare_boot_iso(task, root_uuid):
deploy_iso_href = deploy_info['irmc_deploy_iso']
boot_mode = boot_mode_utils.get_boot_mode(task.node)
- # FIXME(dtantsur): why is iRMC virtual media using PXE options?
- kernel_params = CONF.pxe.kernel_append_params
+ kernel_params = deploy_info['kernel_append_params']
boot_iso_filename = _get_iso_name(task.node, label='boot')
boot_iso_fullpathname = os.path.join(
diff --git a/ironic/tests/unit/drivers/modules/irmc/test_boot.py b/ironic/tests/unit/drivers/modules/irmc/test_boot.py
index c9e2907a4..fa062318b 100644
--- a/ironic/tests/unit/drivers/modules/irmc/test_boot.py
+++ b/ironic/tests/unit/drivers/modules/irmc/test_boot.py
@@ -108,7 +108,67 @@ class IRMCDeployPrivateMethodsTestCase(test_common.BaseIRMCTest):
"""With required 'irmc_deploy_iso' in share."""
isfile_mock.return_value = True
self.node.driver_info['irmc_deploy_iso'] = 'deploy.iso'
- driver_info_expected = {'irmc_deploy_iso': 'deploy.iso'}
+ driver_info_expected = {
+ 'irmc_deploy_iso': 'deploy.iso',
+ 'kernel_append_params': CONF.pxe.kernel_append_params,
+ }
+
+ driver_info_actual = irmc_boot._parse_driver_info(self.node,
+ mode='deploy')
+
+ isfile_mock.assert_called_once_with(
+ '/remote_image_share_root/deploy.iso')
+ self.assertEqual(driver_info_expected, driver_info_actual)
+
+ @mock.patch.object(os.path, 'isfile', spec_set=True, autospec=True)
+ def test__parse_driver_info_kernel_params(self, isfile_mock,
+ check_share_fs_mounted_mock):
+ """With overridden kernel_append_params."""
+ isfile_mock.return_value = True
+ self.node.driver_info['irmc_deploy_iso'] = 'deploy.iso'
+ self.node.instance_info['kernel_append_params'] = 'kernel params'
+ driver_info_expected = {
+ 'irmc_deploy_iso': 'deploy.iso',
+ 'kernel_append_params': 'kernel params',
+ }
+
+ driver_info_actual = irmc_boot._parse_driver_info(self.node,
+ mode='deploy')
+
+ isfile_mock.assert_called_once_with(
+ '/remote_image_share_root/deploy.iso')
+ self.assertEqual(driver_info_expected, driver_info_actual)
+
+ @mock.patch.object(os.path, 'isfile', spec_set=True, autospec=True)
+ def test__parse_driver_info_kernel_params_in_conf(
+ self, isfile_mock, check_share_fs_mounted_mock):
+ """With overridden kernel_append_params."""
+ self.config(kernel_append_params='kernel params', group='irmc')
+ isfile_mock.return_value = True
+ self.node.driver_info['irmc_deploy_iso'] = 'deploy.iso'
+ driver_info_expected = {
+ 'irmc_deploy_iso': 'deploy.iso',
+ 'kernel_append_params': 'kernel params',
+ }
+
+ driver_info_actual = irmc_boot._parse_driver_info(self.node,
+ mode='deploy')
+
+ isfile_mock.assert_called_once_with(
+ '/remote_image_share_root/deploy.iso')
+ self.assertEqual(driver_info_expected, driver_info_actual)
+
+ @mock.patch.object(os.path, 'isfile', spec_set=True, autospec=True)
+ def test__parse_driver_info_kernel_params_in_driver_info(
+ self, isfile_mock, check_share_fs_mounted_mock):
+ """With overridden kernel_append_params."""
+ isfile_mock.return_value = True
+ self.node.driver_info['irmc_deploy_iso'] = 'deploy.iso'
+ self.node.driver_info['kernel_append_params'] = 'kernel params'
+ driver_info_expected = {
+ 'irmc_deploy_iso': 'deploy.iso',
+ 'kernel_append_params': 'kernel params',
+ }
driver_info_actual = irmc_boot._parse_driver_info(self.node,
mode='deploy')
@@ -125,8 +185,10 @@ class IRMCDeployPrivateMethodsTestCase(test_common.BaseIRMCTest):
"""With required 'irmc_deploy_iso' not in share."""
self.node.driver_info['irmc_rescue_iso'] = (
'bc784057-a140-4130-add3-ef890457e6b3')
- driver_info_expected = {'irmc_rescue_iso':
- 'bc784057-a140-4130-add3-ef890457e6b3'}
+ driver_info_expected = {
+ 'irmc_rescue_iso': 'bc784057-a140-4130-add3-ef890457e6b3',
+ 'kernel_append_params': CONF.pxe.kernel_append_params
+ }
is_image_href_ordinary_file_name_mock.return_value = False
driver_info_actual = irmc_boot._parse_driver_info(self.node,
@@ -214,7 +276,10 @@ class IRMCDeployPrivateMethodsTestCase(test_common.BaseIRMCTest):
"""With optional 'irmc_boot_iso' http url."""
self.node.driver_info[
'irmc_deploy_iso'] = 'http://irmc_boot_iso'
- driver_info_expected = {'irmc_deploy_iso': 'http://irmc_boot_iso'}
+ driver_info_expected = {
+ 'irmc_deploy_iso': 'http://irmc_boot_iso',
+ 'kernel_append_params': CONF.pxe.kernel_append_params
+ }
driver_info_actual = irmc_boot._parse_driver_info(self.node)
self.assertEqual(driver_info_expected, driver_info_actual)
@@ -266,9 +331,12 @@ class IRMCDeployPrivateMethodsTestCase(test_common.BaseIRMCTest):
check_share_fs_mounted_mock):
CONF.irmc.remote_image_share_root = '/etc'
get_image_instance_info_mock.return_value = {'a': 'b'}
- driver_info_expected = {'a': 'b',
- 'irmc_deploy_iso': 'hosts',
- 'irmc_boot_iso': 'fstab'}
+ driver_info_expected = {
+ 'a': 'b',
+ 'irmc_deploy_iso': 'hosts',
+ 'irmc_boot_iso': 'fstab',
+ 'kernel_append_params': CONF.pxe.kernel_append_params
+ }
with task_manager.acquire(self.context, self.node.uuid) as task:
task.node.driver_info['irmc_deploy_iso'] = 'hosts'
@@ -492,11 +560,10 @@ class IRMCDeployPrivateMethodsTestCase(test_common.BaseIRMCTest):
boot_mode_mock,
create_boot_iso_mock,
check_share_fs_mounted_mock):
- self.config(kernel_append_params='kernel-params', group='pxe')
-
deploy_info_mock.return_value = \
{'image_source': 'image-uuid',
- 'irmc_deploy_iso': '02f9d414-2ce0-4cf5-b48f-dbc1bf678f55'}
+ 'irmc_deploy_iso': '02f9d414-2ce0-4cf5-b48f-dbc1bf678f55',
+ 'kernel_append_params': 'kernel-params'}
image_props_mock.return_value = {'kernel_id': 'kernel_uuid',
'ramdisk_id': 'ramdisk_uuid'}
diff --git a/releasenotes/notes/irmc-append-params-380a281db43e6013.yaml b/releasenotes/notes/irmc-append-params-380a281db43e6013.yaml
new file mode 100644
index 000000000..8fe88d641
--- /dev/null
+++ b/releasenotes/notes/irmc-append-params-380a281db43e6013.yaml
@@ -0,0 +1,11 @@
+---
+features:
+ - |
+ The ``irmc-virtual-media`` boot interface now supports setting kernel
+ parameters via the ``kernel_append_params`` option in both the node's
+ ``driver_info`` and ``instance_info``. This only applies when an image
+ is built from a kernel and an initramfs, not when a pre-built ISO is used.
+deprecations:
+ - |
+ Using ``[pxe]kernel_append_params`` for the iRMC boot interface is now
+ deprecated, please use ``[irmc]kernel_append_params``.