Allow reusing defaults in per-node kernel_append_params
It may be convenient to use [pxe/redfish/...]kernel_append_params as the universal defaults, while using {driver,instance}_info to only append values. This change allows that by replacing %default% with the value of the applicable configuration option. An example use case: CoreOS requires an additional artifact (root filesystem URL) when PXE booting. While here, fix the PXE/iPXE interface documentation. Change-Id: I829291ab5cc19ec2ca43bc45815d012697f0b408
This commit is contained in:
@@ -206,8 +206,17 @@ user-specified kernel command line parameters.
|
|||||||
.. note::
|
.. note::
|
||||||
The ``driver_info`` field is supported starting with the Xena release.
|
The ``driver_info`` field is supported starting with the Xena release.
|
||||||
|
|
||||||
|
Starting with the Zed cycle, you can combine the parameters from the
|
||||||
|
configuration and from the node using the special ``%default%`` syntax:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
baremetal node set node-0 \
|
||||||
|
--driver-info kernel_append_params="%default% console=ttyS0,115200n8"
|
||||||
|
|
||||||
For ramdisk boot, the ``instance_info[ramdisk_kernel_arguments]`` property
|
For ramdisk boot, the ``instance_info[ramdisk_kernel_arguments]`` property
|
||||||
serves the same purpose.
|
serves the same purpose (``%default%`` is not supported since there is no
|
||||||
|
default value in the configuration).
|
||||||
|
|
||||||
Pre-built ISO images
|
Pre-built ISO images
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@@ -16,15 +16,15 @@ Check your driver documentation at :doc:`../drivers` for details.
|
|||||||
PXE boot
|
PXE boot
|
||||||
--------
|
--------
|
||||||
|
|
||||||
The ``pxe`` boot interface uses PXE_ or iPXE_ to deliver the target
|
The ``pxe`` and ``ipxe`` boot interfaces uses PXE_ or iPXE_ accordingly to
|
||||||
kernel/ramdisk pair. PXE uses relatively slow and unreliable TFTP protocol
|
deliver the target kernel/ramdisk pair. PXE uses relatively slow and unreliable
|
||||||
for transfer, while iPXE uses HTTP. The downside of iPXE is that it's less
|
TFTP protocol for transfer, while iPXE uses HTTP. The downside of iPXE is that
|
||||||
common, and usually requires bootstrapping using PXE first.
|
it's less common, and usually requires bootstrapping using PXE first.
|
||||||
|
|
||||||
The ``pxe`` boot interface works by preparing a PXE/iPXE environment for a
|
The ``pxe`` and ``ipxe`` boot interfaces work by preparing a PXE/iPXE
|
||||||
node on the file system, then instructing the DHCP provider (for example,
|
environment for a node on the file system, then instructing the DHCP provider
|
||||||
the Networking service) to boot the node from it. See
|
(for example, the Networking service) to boot the node from it. See
|
||||||
ref:`direct-deploy-example` for a better understanding of the whole deployment
|
:ref:`direct-deploy-example` for a better understanding of the whole deployment
|
||||||
process.
|
process.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
@@ -32,13 +32,50 @@ process.
|
|||||||
instead of conventional BIOS boot. This is particularly important for CPU
|
instead of conventional BIOS boot. This is particularly important for CPU
|
||||||
architectures that do not have BIOS support at all.
|
architectures that do not have BIOS support at all.
|
||||||
|
|
||||||
The ``pxe`` boot interface is used by default for many hardware types,
|
The ``ipxe`` boot interface is used by default for many hardware types,
|
||||||
including ``ipmi``. Some hardware types, notably ``ilo`` and ``irmc`` have their
|
including ``ipmi``. Some hardware types, notably ``ilo`` and ``irmc`` have
|
||||||
specific implementations of the PXE boot interface.
|
their specific implementations of the PXE boot interface.
|
||||||
|
|
||||||
Additional configuration is required for this boot interface - see
|
Additional configuration is required for this boot interface - see
|
||||||
:doc:`/install/configure-pxe` for details.
|
:doc:`/install/configure-pxe` for details.
|
||||||
|
|
||||||
|
Kernel parameters
|
||||||
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
If you need to pass additional kernel parameters to the deployment/cleaning
|
||||||
|
ramdisk (for example, to configure serial console), use the following
|
||||||
|
configuration option:
|
||||||
|
|
||||||
|
.. code-block:: ini
|
||||||
|
|
||||||
|
[pxe]
|
||||||
|
kernel_append_params = nofb nomodeset vga=normal
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
The option was called ``pxe_append_params`` before the Xena cycle.
|
||||||
|
|
||||||
|
Per-node and per-instance overrides are also possible, for example:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
baremetal node set node-0 \
|
||||||
|
--driver-info kernel_append_params="nofb nomodeset vga=normal"
|
||||||
|
baremetal node set node-0 \
|
||||||
|
--instance-info kernel_append_params="nofb nomodeset vga=normal"
|
||||||
|
|
||||||
|
Starting with the Zed cycle, you can combine the parameters from the
|
||||||
|
configuration and from the node using the special ``%default%`` syntax:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
baremetal node set node-0 \
|
||||||
|
--driver-info kernel_append_params="%default% console=ttyS0,115200n8"
|
||||||
|
|
||||||
|
Together with the configuration above, the following parameters will be
|
||||||
|
appended to the kernel command line::
|
||||||
|
|
||||||
|
nofb nomodeset vga=normal console=ttyS0,115200n8
|
||||||
|
|
||||||
Common options
|
Common options
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
@@ -74,12 +74,8 @@ OPTIONAL_PROPERTIES = {
|
|||||||
'ilo_add_certificates': _("Boolean value that indicates whether the "
|
'ilo_add_certificates': _("Boolean value that indicates whether the "
|
||||||
"certificates require to be added to the "
|
"certificates require to be added to the "
|
||||||
"iLO."),
|
"iLO."),
|
||||||
'kernel_append_params': _("Additional kernel parameters to pass down "
|
'kernel_append_params': driver_utils.KERNEL_APPEND_PARAMS_DESCRIPTION %
|
||||||
"to instance kernel. These parameters can "
|
{'option_group': 'ilo'},
|
||||||
"be consumed by the kernel or by the "
|
|
||||||
"applications by reading /proc/cmdline. "
|
|
||||||
"Mind severe cmdline size limit. Overrides "
|
|
||||||
"[ilo]/kernel_append_params ironic option.")
|
|
||||||
}
|
}
|
||||||
COMMON_PROPERTIES = REQUIRED_PROPERTIES
|
COMMON_PROPERTIES = REQUIRED_PROPERTIES
|
||||||
|
|
||||||
|
@@ -80,13 +80,8 @@ OPTIONAL_PROPERTIES = {
|
|||||||
"the IPv4 subnet mask that the storage network is configured to "
|
"the IPv4 subnet mask that the storage network is configured to "
|
||||||
"utilize, in a range between 1 and 31 inclusive. This is necessary "
|
"utilize, in a range between 1 and 31 inclusive. This is necessary "
|
||||||
"for booting a node from a remote iSCSI volume. Optional."),
|
"for booting a node from a remote iSCSI volume. Optional."),
|
||||||
'kernel_append_params': _("Additional kernel parameters to pass down to "
|
'kernel_append_params': driver_utils.KERNEL_APPEND_PARAMS_DESCRIPTION %
|
||||||
"instance kernel. These parameters can be "
|
{'option_group': 'irmc'},
|
||||||
"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()
|
COMMON_PROPERTIES = REQUIRED_PROPERTIES.copy()
|
||||||
|
@@ -50,13 +50,8 @@ RESCUE_PROPERTIES = {
|
|||||||
'required for rescue mode.'),
|
'required for rescue mode.'),
|
||||||
}
|
}
|
||||||
OPTIONAL_PROPERTIES = {
|
OPTIONAL_PROPERTIES = {
|
||||||
'kernel_append_params': _("Additional kernel parameters to pass down to "
|
'kernel_append_params': driver_utils.KERNEL_APPEND_PARAMS_DESCRIPTION %
|
||||||
"instance kernel. These parameters can be "
|
{'option_group': 'pxe'},
|
||||||
"consumed by the kernel or by the applications "
|
|
||||||
"by reading /proc/cmdline. Mind severe cmdline "
|
|
||||||
"size limit. Overrides "
|
|
||||||
"[pxe]/kernel_append_params ironic "
|
|
||||||
"option."),
|
|
||||||
}
|
}
|
||||||
COMMON_PROPERTIES = REQUIRED_PROPERTIES.copy()
|
COMMON_PROPERTIES = REQUIRED_PROPERTIES.copy()
|
||||||
COMMON_PROPERTIES.update(driver_utils.OPTIONAL_PROPERTIES)
|
COMMON_PROPERTIES.update(driver_utils.OPTIONAL_PROPERTIES)
|
||||||
|
@@ -46,13 +46,8 @@ OPTIONAL_PROPERTIES = {
|
|||||||
"driver should use virtual media USB or floppy "
|
"driver should use virtual media USB or floppy "
|
||||||
"device for passing configuration information "
|
"device for passing configuration information "
|
||||||
"to the ramdisk. Defaults to False. Optional."),
|
"to the ramdisk. Defaults to False. Optional."),
|
||||||
'kernel_append_params': _("Additional kernel parameters to pass down to "
|
'kernel_append_params': driver_utils.KERNEL_APPEND_PARAMS_DESCRIPTION %
|
||||||
"instance kernel. These parameters can be "
|
{'option_group': 'redfish'},
|
||||||
"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 "
|
'bootloader': _("URL or Glance UUID of the EFI system partition "
|
||||||
"image containing EFI boot loader. This image will be "
|
"image containing EFI boot loader. This image will be "
|
||||||
"used by ironic when building UEFI-bootable ISO "
|
"used by ironic when building UEFI-bootable ISO "
|
||||||
|
@@ -384,6 +384,17 @@ OPTIONAL_PROPERTIES = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
KERNEL_APPEND_PARAMS_DESCRIPTION = _(
|
||||||
|
"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. "
|
||||||
|
"When used with virtual media, only applies to ISO images that Ironic "
|
||||||
|
"builds, but not to pre-built ISOs provided via e.g. deploy_iso. "
|
||||||
|
"Overrides the [%(option_group)s]/kernel_append_params configuration "
|
||||||
|
"option, use %%default%% to insert its value."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_kernel_append_params(node, default):
|
def get_kernel_append_params(node, default):
|
||||||
"""Get the applicable kernel params.
|
"""Get the applicable kernel params.
|
||||||
|
|
||||||
@@ -399,7 +410,7 @@ def get_kernel_append_params(node, default):
|
|||||||
for location in ('instance_info', 'driver_info'):
|
for location in ('instance_info', 'driver_info'):
|
||||||
result = getattr(node, location).get('kernel_append_params')
|
result = getattr(node, location).get('kernel_append_params')
|
||||||
if result is not None:
|
if result is not None:
|
||||||
return result
|
return result.replace('%default%', default or '')
|
||||||
|
|
||||||
return default
|
return default
|
||||||
|
|
||||||
|
@@ -1712,6 +1712,15 @@ class PXEBuildConfigOptionsTestCase(db_base.DbTestCase):
|
|||||||
self._test_build_pxe_config_options_pxe(whle_dsk_img=True,
|
self._test_build_pxe_config_options_pxe(whle_dsk_img=True,
|
||||||
expected_pxe_params='params2')
|
expected_pxe_params='params2')
|
||||||
|
|
||||||
|
def test_build_pxe_config_options_kernel_params_with_default(self):
|
||||||
|
info = self.node.driver_info
|
||||||
|
info['kernel_append_params'] = 'param1 %default% params2'
|
||||||
|
self.node.driver_info = info
|
||||||
|
self.node.save()
|
||||||
|
self._test_build_pxe_config_options_pxe(
|
||||||
|
whle_dsk_img=True,
|
||||||
|
expected_pxe_params='param1 test_param params2')
|
||||||
|
|
||||||
def test_build_pxe_config_options_kernel_params_from_instance_info(self):
|
def test_build_pxe_config_options_kernel_params_from_instance_info(self):
|
||||||
info = self.node.instance_info
|
info = self.node.instance_info
|
||||||
info['kernel_append_params'] = 'params2'
|
info['kernel_append_params'] = 'params2'
|
||||||
|
@@ -579,6 +579,29 @@ class RedfishImageUtilsTestCase(db_base.DbTestCase):
|
|||||||
root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
|
root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
|
||||||
inject_files=None)
|
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_defaults(
|
||||||
|
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'] = \
|
||||||
|
f'%default% {kernel_params}'
|
||||||
|
|
||||||
|
image_utils._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='uefi', esp_image_href=None,
|
||||||
|
kernel_params=f'nofb nomodeset vga=normal {kernel_params}',
|
||||||
|
root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
|
||||||
|
inject_files=None)
|
||||||
|
|
||||||
@mock.patch.object(image_utils.ImageHandler, 'publish_image',
|
@mock.patch.object(image_utils.ImageHandler, 'publish_image',
|
||||||
autospec=True)
|
autospec=True)
|
||||||
@mock.patch.object(images, 'create_boot_iso', autospec=True)
|
@mock.patch.object(images, 'create_boot_iso', autospec=True)
|
||||||
|
10
releasenotes/notes/append-params-a8b9f844328da83e.yaml
Normal file
10
releasenotes/notes/append-params-a8b9f844328da83e.yaml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
When using per-node kernel parameters, i.e. ``kernel_append_params`` in the
|
||||||
|
node's ``instance_info`` or ``driver_info``, it is now possible to insert
|
||||||
|
the value of the driver's configuration option (e.g.
|
||||||
|
``[pxe]kernel_append_params`` via the special ``%default%`` syntax, e.g.::
|
||||||
|
|
||||||
|
baremetal node set node-0 \
|
||||||
|
--driver-info kernel_append_params="%default% foo=bar"
|
Reference in New Issue
Block a user