Add instance_info/kernel_append_params
to redfish
Adds `instance_info/kernel_append_params` property support to `redfish` hardware type. If given, this property overrides `[redfish]/kernel_append_params` ironic option. The rationale for adding this property is to allow passing node-specific kernel parameters to instance kernel. One of the use-cases for this is to pass node static network configuration to the kernel. Change-Id: Ib1617f5a7ab34968d8bfe06fe49f3ba68e56f99f Story: 2006691 Task: 36988
This commit is contained in:
parent
8990e7dcbc
commit
605f744570
@ -176,6 +176,12 @@ If ``[driver_info]/config_via_floppy`` boolean property of the node is set to
|
||||
place into on a FAT image, then insert the image into node's virtual floppy
|
||||
drive.
|
||||
|
||||
When booting over PXE or virtual media, and user instance requires some
|
||||
specific kernel configuration, ``[instance_info]/kernel_append_params``
|
||||
property can be used to pass user-specified kernel command line parameters.
|
||||
For ramdisk kernel, ``[instance_info]/kernel_append_params`` property serves
|
||||
the same purpose.
|
||||
|
||||
.. _Redfish: http://redfish.dmtf.org/
|
||||
.. _Sushy: https://opendev.org/openstack/sushy
|
||||
.. _TLS: https://en.wikipedia.org/wiki/Transport_Layer_Security
|
||||
|
@ -62,8 +62,12 @@ opts = [
|
||||
'enabled.')),
|
||||
cfg.StrOpt('kernel_append_params',
|
||||
default='nofb nomodeset vga=normal',
|
||||
help=_('Additional kernel parameters for baremetal '
|
||||
'Virtual Media boot.')),
|
||||
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.')),
|
||||
]
|
||||
|
||||
|
||||
|
@ -50,11 +50,19 @@ OPTIONAL_PROPERTIES = {
|
||||
"driver should use virtual media Floppy device "
|
||||
"for passing configuration information to the "
|
||||
"ramdisk. Defaults to False. 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 "
|
||||
"[redfish]/kernel_append_params ironic "
|
||||
"option."),
|
||||
'bootloader': _("URL or Glance UUID of the EFI system partition "
|
||||
"image containing EFI boot loader. This image will be "
|
||||
"used by ironic when building UEFI-bootable ISO "
|
||||
"out of kernel and ramdisk. Required for UEFI "
|
||||
"boot from partition images.")
|
||||
"boot from partition images."),
|
||||
|
||||
}
|
||||
|
||||
RESCUE_PROPERTIES = {
|
||||
@ -431,12 +439,15 @@ class RedfishVirtualMediaBoot(base.BootInterface):
|
||||
"building ISO for %(node)s") %
|
||||
{'node': task.node.uuid})
|
||||
|
||||
i_info = task.node.instance_info
|
||||
|
||||
if deploy_utils.get_boot_option(task.node) == "ramdisk":
|
||||
i_info = task.node.instance_info
|
||||
kernel_params = "root=/dev/ram0 text "
|
||||
kernel_params += i_info.get("ramdisk_kernel_arguments", "")
|
||||
|
||||
else:
|
||||
kernel_params = CONF.redfish.kernel_append_params
|
||||
kernel_params = i_info.get(
|
||||
'kernel_append_params', CONF.redfish.kernel_append_params)
|
||||
|
||||
if params:
|
||||
kernel_params = ' '.join(
|
||||
|
@ -397,6 +397,27 @@ class RedfishVirtualMediaBootTestCase(db_base.DbTestCase):
|
||||
|
||||
self.assertEqual(expected_url, url)
|
||||
|
||||
@mock.patch.object(redfish_boot.RedfishVirtualMediaBoot,
|
||||
'_publish_image', autospec=True)
|
||||
@mock.patch.object(images, 'create_boot_iso', autospec=True)
|
||||
def test__prepare_iso_image_kernel_params(
|
||||
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.instance_info.update(kernel_append_params=kernel_params)
|
||||
|
||||
task.driver.boot._prepare_iso_image(
|
||||
task, 'http://kernel/img', 'http://ramdisk/img',
|
||||
bootloader_href=None, root_uuid=task.node.uuid)
|
||||
|
||||
mock_create_boot_iso.assert_called_once_with(
|
||||
mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img',
|
||||
boot_mode=None, esp_image_href=None,
|
||||
kernel_params=kernel_params,
|
||||
root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123')
|
||||
|
||||
@mock.patch.object(redfish_boot.RedfishVirtualMediaBoot,
|
||||
'_prepare_iso_image', autospec=True)
|
||||
def test__prepare_deploy_iso(self, mock__prepare_iso_image):
|
||||
|
@ -0,0 +1,9 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Adds ``instance_info/kernel_append_params`` property support to ``redfish``
|
||||
hardware type. If given, this property overrides
|
||||
``[redfish]/kernel_append_params`` ironic option. The rationale for adding
|
||||
this property is to allow passing node-specific kernel parameters to instance
|
||||
kernel. One of the use-cases for this is to pass node static network
|
||||
configuration to the kernel.
|
Loading…
x
Reference in New Issue
Block a user