Clean up kernel_append_params for Redfish and iLO
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 The existing ilo_kernel_append_params is declared but never implemented, so it's removed without deprecation in favor of the new option. Story: #2008902 Task: #42470 Task: #42471 Change-Id: I0fcd7c63a4bc41110eb7f4cd4031580ef98d9a19
This commit is contained in:
parent
2a73f5a84e
commit
e51404c8e7
@ -193,10 +193,21 @@ place into on a FAT image, then insert the image into node's virtual floppy
|
|||||||
drive.
|
drive.
|
||||||
|
|
||||||
When booting over PXE or virtual media, and user instance requires some
|
When booting over PXE or virtual media, and user instance requires some
|
||||||
specific kernel configuration, ``[instance_info]/kernel_append_params``
|
specific kernel configuration, the node's
|
||||||
property can be used to pass user-specified kernel command line parameters.
|
``instance_info[kernel_append_params]`` or
|
||||||
For ramdisk kernel, ``[instance_info]/kernel_append_params`` property serves
|
``driver_info[kernel_append_params]`` properties can be used to pass
|
||||||
the same purpose.
|
user-specified kernel command line parameters.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
baremetal node set node-0 \
|
||||||
|
--driver-info kernel_append_params="nofb nomodeset vga=normal"
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
The ``driver_info`` field is supported starting with the Xena release.
|
||||||
|
|
||||||
|
For ramdisk boot, the ``instance_info[ramdisk_kernel_arguments]`` property
|
||||||
|
serves the same purpose.
|
||||||
|
|
||||||
Pre-built ISO images
|
Pre-built ISO images
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -79,12 +79,12 @@ OPTIONAL_PROPERTIES = {
|
|||||||
"iLO.")
|
"iLO.")
|
||||||
}
|
}
|
||||||
KERNEL_PARAM_PROPERTIES = {
|
KERNEL_PARAM_PROPERTIES = {
|
||||||
'ilo_kernel_append_params': _("Additional kernel parameters to pass down "
|
'kernel_append_params': _("Additional kernel parameters to pass down "
|
||||||
"to instance kernel. These parameters can "
|
"to instance kernel. These parameters can "
|
||||||
"be consumed by the kernel or by the "
|
"be consumed by the kernel or by the "
|
||||||
"applications by reading /proc/cmdline. "
|
"applications by reading /proc/cmdline. "
|
||||||
"Mind severe cmdline size limit. Overrides "
|
"Mind severe cmdline size limit. Overrides "
|
||||||
"[ilo]/kernel_append_params ironic option.")
|
"[ilo]/kernel_append_params ironic option.")
|
||||||
}
|
}
|
||||||
COMMON_PROPERTIES = REQUIRED_PROPERTIES
|
COMMON_PROPERTIES = REQUIRED_PROPERTIES
|
||||||
VMEDIA_OPTIONAL_PROPERTIES = OPTIONAL_PROPERTIES.copy()
|
VMEDIA_OPTIONAL_PROPERTIES = OPTIONAL_PROPERTIES.copy()
|
||||||
|
@ -33,6 +33,7 @@ from ironic.common import utils
|
|||||||
from ironic.conf import CONF
|
from ironic.conf import CONF
|
||||||
from ironic.drivers.modules import boot_mode_utils
|
from ironic.drivers.modules import boot_mode_utils
|
||||||
from ironic.drivers.modules import deploy_utils
|
from ironic.drivers.modules import deploy_utils
|
||||||
|
from ironic.drivers import utils as driver_utils
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
@ -433,7 +434,6 @@ def _prepare_iso_image(task, kernel_href, ramdisk_href,
|
|||||||
{"boot_iso": base_iso})
|
{"boot_iso": base_iso})
|
||||||
|
|
||||||
img_handler = ImageHandler(task.node.driver)
|
img_handler = ImageHandler(task.node.driver)
|
||||||
k_param = img_handler.kernel_params
|
|
||||||
|
|
||||||
i_info = task.node.instance_info
|
i_info = task.node.instance_info
|
||||||
|
|
||||||
@ -447,7 +447,8 @@ def _prepare_iso_image(task, kernel_href, ramdisk_href,
|
|||||||
kernel_params = None
|
kernel_params = None
|
||||||
|
|
||||||
else:
|
else:
|
||||||
kernel_params = i_info.get('kernel_append_params', k_param)
|
kernel_params = driver_utils.get_kernel_append_params(
|
||||||
|
task.node, default=img_handler.kernel_params)
|
||||||
|
|
||||||
if params and not base_iso:
|
if params and not base_iso:
|
||||||
kernel_params = ' '.join(
|
kernel_params = ' '.join(
|
||||||
|
@ -54,9 +54,9 @@ class IloBootCommonMethodsTestCase(test_common.BaseIloTest):
|
|||||||
|
|
||||||
def test_parse_driver_info_deploy_iso(self):
|
def test_parse_driver_info_deploy_iso(self):
|
||||||
self.node.driver_info['ilo_deploy_iso'] = 'deploy-iso'
|
self.node.driver_info['ilo_deploy_iso'] = 'deploy-iso'
|
||||||
self.node.driver_info['ilo_kernel_append_params'] = 'kernel-param'
|
self.node.driver_info['kernel_append_params'] = 'kernel-param'
|
||||||
expected_driver_info = {'ilo_bootloader': None,
|
expected_driver_info = {'ilo_bootloader': None,
|
||||||
'ilo_kernel_append_params': 'kernel-param',
|
'kernel_append_params': 'kernel-param',
|
||||||
'ilo_deploy_iso': 'deploy-iso'}
|
'ilo_deploy_iso': 'deploy-iso'}
|
||||||
|
|
||||||
actual_driver_info = ilo_boot.parse_driver_info(self.node)
|
actual_driver_info = ilo_boot.parse_driver_info(self.node)
|
||||||
@ -65,7 +65,7 @@ class IloBootCommonMethodsTestCase(test_common.BaseIloTest):
|
|||||||
def test_parse_driver_info_rescue_iso(self):
|
def test_parse_driver_info_rescue_iso(self):
|
||||||
self.node.driver_info['ilo_rescue_iso'] = 'rescue-iso'
|
self.node.driver_info['ilo_rescue_iso'] = 'rescue-iso'
|
||||||
expected_driver_info = {'ilo_bootloader': None,
|
expected_driver_info = {'ilo_bootloader': None,
|
||||||
'ilo_kernel_append_params': None,
|
'kernel_append_params': None,
|
||||||
'ilo_rescue_iso': 'rescue-iso'}
|
'ilo_rescue_iso': 'rescue-iso'}
|
||||||
|
|
||||||
actual_driver_info = ilo_boot.parse_driver_info(self.node, 'rescue')
|
actual_driver_info = ilo_boot.parse_driver_info(self.node, 'rescue')
|
||||||
@ -75,11 +75,11 @@ class IloBootCommonMethodsTestCase(test_common.BaseIloTest):
|
|||||||
self.node.driver_info['ilo_deploy_kernel'] = 'kernel'
|
self.node.driver_info['ilo_deploy_kernel'] = 'kernel'
|
||||||
self.node.driver_info['ilo_deploy_ramdisk'] = 'ramdisk'
|
self.node.driver_info['ilo_deploy_ramdisk'] = 'ramdisk'
|
||||||
self.node.driver_info['ilo_bootloader'] = 'bootloader'
|
self.node.driver_info['ilo_bootloader'] = 'bootloader'
|
||||||
self.node.driver_info['ilo_kernel_append_params'] = 'kernel-param'
|
self.node.driver_info['kernel_append_params'] = 'kernel-param'
|
||||||
expected_driver_info = {'ilo_deploy_kernel': 'kernel',
|
expected_driver_info = {'ilo_deploy_kernel': 'kernel',
|
||||||
'ilo_deploy_ramdisk': 'ramdisk',
|
'ilo_deploy_ramdisk': 'ramdisk',
|
||||||
'ilo_bootloader': 'bootloader',
|
'ilo_bootloader': 'bootloader',
|
||||||
'ilo_kernel_append_params': 'kernel-param'}
|
'kernel_append_params': 'kernel-param'}
|
||||||
|
|
||||||
actual_driver_info = ilo_boot.parse_driver_info(self.node)
|
actual_driver_info = ilo_boot.parse_driver_info(self.node)
|
||||||
self.assertEqual(expected_driver_info, actual_driver_info)
|
self.assertEqual(expected_driver_info, actual_driver_info)
|
||||||
@ -91,7 +91,7 @@ class IloBootCommonMethodsTestCase(test_common.BaseIloTest):
|
|||||||
expected_driver_info = {'ilo_rescue_kernel': 'kernel',
|
expected_driver_info = {'ilo_rescue_kernel': 'kernel',
|
||||||
'ilo_rescue_ramdisk': 'ramdisk',
|
'ilo_rescue_ramdisk': 'ramdisk',
|
||||||
'ilo_bootloader': 'bootloader',
|
'ilo_bootloader': 'bootloader',
|
||||||
'ilo_kernel_append_params': None}
|
'kernel_append_params': None}
|
||||||
|
|
||||||
actual_driver_info = ilo_boot.parse_driver_info(self.node, 'rescue')
|
actual_driver_info = ilo_boot.parse_driver_info(self.node, 'rescue')
|
||||||
self.assertEqual(expected_driver_info, actual_driver_info)
|
self.assertEqual(expected_driver_info, actual_driver_info)
|
||||||
@ -103,7 +103,7 @@ class IloBootCommonMethodsTestCase(test_common.BaseIloTest):
|
|||||||
expected_driver_info = {'ilo_deploy_kernel': 'kernel',
|
expected_driver_info = {'ilo_deploy_kernel': 'kernel',
|
||||||
'ilo_deploy_ramdisk': 'ramdisk',
|
'ilo_deploy_ramdisk': 'ramdisk',
|
||||||
'ilo_bootloader': 'bootloader',
|
'ilo_bootloader': 'bootloader',
|
||||||
'ilo_kernel_append_params': None}
|
'kernel_append_params': None}
|
||||||
|
|
||||||
actual_driver_info = ilo_boot.parse_driver_info(self.node)
|
actual_driver_info = ilo_boot.parse_driver_info(self.node)
|
||||||
self.assertEqual(expected_driver_info, actual_driver_info)
|
self.assertEqual(expected_driver_info, actual_driver_info)
|
||||||
@ -116,7 +116,7 @@ class IloBootCommonMethodsTestCase(test_common.BaseIloTest):
|
|||||||
expected_driver_info = {'ilo_rescue_kernel': 'kernel',
|
expected_driver_info = {'ilo_rescue_kernel': 'kernel',
|
||||||
'ilo_rescue_ramdisk': 'ramdisk',
|
'ilo_rescue_ramdisk': 'ramdisk',
|
||||||
'ilo_bootloader': 'bootloader',
|
'ilo_bootloader': 'bootloader',
|
||||||
'ilo_kernel_append_params': None}
|
'kernel_append_params': None}
|
||||||
|
|
||||||
actual_driver_info = ilo_boot.parse_driver_info(self.node, 'rescue')
|
actual_driver_info = ilo_boot.parse_driver_info(self.node, 'rescue')
|
||||||
self.assertEqual(expected_driver_info, actual_driver_info)
|
self.assertEqual(expected_driver_info, actual_driver_info)
|
||||||
@ -128,7 +128,7 @@ class IloBootCommonMethodsTestCase(test_common.BaseIloTest):
|
|||||||
expected_driver_info = {'ilo_deploy_kernel': 'kernel',
|
expected_driver_info = {'ilo_deploy_kernel': 'kernel',
|
||||||
'ilo_deploy_ramdisk': 'ramdisk',
|
'ilo_deploy_ramdisk': 'ramdisk',
|
||||||
'ilo_bootloader': None,
|
'ilo_bootloader': None,
|
||||||
'ilo_kernel_append_params': None}
|
'kernel_append_params': None}
|
||||||
|
|
||||||
actual_driver_info = ilo_boot.parse_driver_info(self.node)
|
actual_driver_info = ilo_boot.parse_driver_info(self.node)
|
||||||
self.assertEqual(expected_driver_info, actual_driver_info)
|
self.assertEqual(expected_driver_info, actual_driver_info)
|
||||||
@ -1546,7 +1546,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
|
|||||||
'ilo_deploy_kernel': 'deploy-kernel',
|
'ilo_deploy_kernel': 'deploy-kernel',
|
||||||
'ilo_deploy_ramdisk': 'deploy-ramdisk',
|
'ilo_deploy_ramdisk': 'deploy-ramdisk',
|
||||||
'ilo_bootloader': 'bootloader',
|
'ilo_bootloader': 'bootloader',
|
||||||
'ilo_kernel_append_params': 'nofb nomodeset vga=normal'
|
'kernel_append_params': 'nofb nomodeset vga=normal'
|
||||||
}
|
}
|
||||||
|
|
||||||
deploy_info.update({'ilo_username': 'admin',
|
deploy_info.update({'ilo_username': 'admin',
|
||||||
@ -1577,7 +1577,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
|
|||||||
driver_info['ilo_rescue_ramdisk'] = 'rescue-ramdisk'
|
driver_info['ilo_rescue_ramdisk'] = 'rescue-ramdisk'
|
||||||
driver_info['ilo_bootloader'] = 'bootloader'
|
driver_info['ilo_bootloader'] = 'bootloader'
|
||||||
driver_info['ilo_add_certificates'] = 'false'
|
driver_info['ilo_add_certificates'] = 'false'
|
||||||
driver_info['ilo_kernel_append_params'] = 'kernel-param'
|
driver_info['kernel_append_params'] = 'kernel-param'
|
||||||
driver_info['dummy_key'] = 'dummy-value'
|
driver_info['dummy_key'] = 'dummy-value'
|
||||||
self.node.driver_info = driver_info
|
self.node.driver_info = driver_info
|
||||||
self.node.save()
|
self.node.save()
|
||||||
@ -1588,7 +1588,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
|
|||||||
'ilo_rescue_kernel': 'rescue-kernel',
|
'ilo_rescue_kernel': 'rescue-kernel',
|
||||||
'ilo_rescue_ramdisk': 'rescue-ramdisk',
|
'ilo_rescue_ramdisk': 'rescue-ramdisk',
|
||||||
'ilo_bootloader': 'bootloader',
|
'ilo_bootloader': 'bootloader',
|
||||||
'ilo_kernel_append_params': 'kernel-param'
|
'kernel_append_params': 'kernel-param'
|
||||||
}
|
}
|
||||||
|
|
||||||
deploy_info.update({'ilo_username': 'admin',
|
deploy_info.update({'ilo_username': 'admin',
|
||||||
|
@ -553,6 +553,29 @@ class RedfishImageUtilsTestCase(db_base.DbTestCase):
|
|||||||
root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
|
root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
|
||||||
base_iso='/path/to/baseiso', inject_files=None)
|
base_iso='/path/to/baseiso', inject_files=None)
|
||||||
|
|
||||||
|
@mock.patch.object(image_utils.ImageHandler, 'publish_image',
|
||||||
|
autospec=True)
|
||||||
|
@mock.patch.object(images, 'create_boot_iso', autospec=True)
|
||||||
|
def test__prepare_iso_image_kernel_params_driver_info(
|
||||||
|
self, mock_create_boot_iso, mock_publish_image):
|
||||||
|
with task_manager.acquire(self.context, self.node.uuid,
|
||||||
|
shared=True) as task:
|
||||||
|
kernel_params = 'network-config=base64-cloudinit-blob'
|
||||||
|
|
||||||
|
task.node.driver_info['kernel_append_params'] = kernel_params
|
||||||
|
|
||||||
|
image_utils._prepare_iso_image(
|
||||||
|
task, 'http://kernel/img', 'http://ramdisk/img',
|
||||||
|
bootloader_href=None, root_uuid=task.node.uuid,
|
||||||
|
base_iso='/path/to/baseiso')
|
||||||
|
|
||||||
|
mock_create_boot_iso.assert_called_once_with(
|
||||||
|
mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img',
|
||||||
|
boot_mode='bios', esp_image_href=None,
|
||||||
|
kernel_params=kernel_params,
|
||||||
|
root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
|
||||||
|
base_iso='/path/to/baseiso', inject_files=None)
|
||||||
|
|
||||||
def test__prepare_iso_image_bootable_iso(self):
|
def test__prepare_iso_image_bootable_iso(self):
|
||||||
with task_manager.acquire(self.context, self.node.uuid,
|
with task_manager.acquire(self.context, self.node.uuid,
|
||||||
shared=True) as task:
|
shared=True) as task:
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
The ``redfish-virtual-media``, ``ilo-virtual-media`` and
|
||||||
|
``idrac-redfish-virtual-media`` boot interfaces now support
|
||||||
|
``kernel_append_params`` not only in the node's ``instance_info``, but also
|
||||||
|
``driver_info``. This only applies when the boot image is built from
|
||||||
|
a kernel and an initramfs, not when a pre-built ISO is used.
|
||||||
|
deprecations:
|
||||||
|
- |
|
||||||
|
The ``ilo-virtual-media`` boot interface has previously declared support
|
||||||
|
for the ``ilo_kernel_append_params`` option in ``driver_info``. It has
|
||||||
|
never been implemented in reality and has been replaces by the new
|
||||||
|
``kernel_append_params``.
|
Loading…
Reference in New Issue
Block a user