Clean up kernel_append_params for iRMC
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. [$driver]kernel_append_params Story: #2008902 Task: #42472 Change-Id: Ib83594743ae58ea26dbd9875c98ab169dd5ab009
This commit is contained in:
parent
2a73f5a84e
commit
722326f675
@ -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.')),
|
||||
]
|
||||
|
||||
|
||||
|
@ -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(
|
||||
|
@ -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'}
|
||||
|
||||
|
11
releasenotes/notes/irmc-append-params-380a281db43e6013.yaml
Normal file
11
releasenotes/notes/irmc-append-params-380a281db43e6013.yaml
Normal file
@ -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``.
|
Loading…
Reference in New Issue
Block a user