diff options
author | Dmitry Tantsur <dtantsur@protonmail.com> | 2022-04-11 18:48:13 +0200 |
---|---|---|
committer | Dmitry Tantsur <dtantsur@protonmail.com> | 2022-04-11 18:54:42 +0200 |
commit | 5feb39844ab1a3f266669f01b6a13f39462b4612 (patch) | |
tree | 655de33e33b1bd6d013fe26919e6925574b06460 /ironic/drivers | |
parent | 688f8cb7e8ce454d8df695a15abf8a4ac8ffa119 (diff) | |
download | ironic-5feb39844ab1a3f266669f01b6a13f39462b4612.tar.gz |
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
Diffstat (limited to 'ironic/drivers')
-rw-r--r-- | ironic/drivers/modules/ilo/boot.py | 8 | ||||
-rw-r--r-- | ironic/drivers/modules/irmc/boot.py | 9 | ||||
-rw-r--r-- | ironic/drivers/modules/pxe_base.py | 9 | ||||
-rw-r--r-- | ironic/drivers/modules/redfish/boot.py | 9 | ||||
-rw-r--r-- | ironic/drivers/utils.py | 13 |
5 files changed, 20 insertions, 28 deletions
diff --git a/ironic/drivers/modules/ilo/boot.py b/ironic/drivers/modules/ilo/boot.py index 5087e3998..7f5c5adcf 100644 --- a/ironic/drivers/modules/ilo/boot.py +++ b/ironic/drivers/modules/ilo/boot.py @@ -74,12 +74,8 @@ OPTIONAL_PROPERTIES = { 'ilo_add_certificates': _("Boolean value that indicates whether the " "certificates require to be added to the " "iLO."), - '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 " - "[ilo]/kernel_append_params ironic option.") + 'kernel_append_params': driver_utils.KERNEL_APPEND_PARAMS_DESCRIPTION % + {'option_group': 'ilo'}, } COMMON_PROPERTIES = REQUIRED_PROPERTIES diff --git a/ironic/drivers/modules/irmc/boot.py b/ironic/drivers/modules/irmc/boot.py index 1195a0670..84964bd2f 100644 --- a/ironic/drivers/modules/irmc/boot.py +++ b/ironic/drivers/modules/irmc/boot.py @@ -80,13 +80,8 @@ 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."), + 'kernel_append_params': driver_utils.KERNEL_APPEND_PARAMS_DESCRIPTION % + {'option_group': 'irmc'}, } COMMON_PROPERTIES = REQUIRED_PROPERTIES.copy() diff --git a/ironic/drivers/modules/pxe_base.py b/ironic/drivers/modules/pxe_base.py index a89c9e443..317b65b85 100644 --- a/ironic/drivers/modules/pxe_base.py +++ b/ironic/drivers/modules/pxe_base.py @@ -50,13 +50,8 @@ RESCUE_PROPERTIES = { 'required for rescue mode.'), } OPTIONAL_PROPERTIES = { - '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 " - "[pxe]/kernel_append_params ironic " - "option."), + 'kernel_append_params': driver_utils.KERNEL_APPEND_PARAMS_DESCRIPTION % + {'option_group': 'pxe'}, } COMMON_PROPERTIES = REQUIRED_PROPERTIES.copy() COMMON_PROPERTIES.update(driver_utils.OPTIONAL_PROPERTIES) diff --git a/ironic/drivers/modules/redfish/boot.py b/ironic/drivers/modules/redfish/boot.py index 55c826fc6..1ce05ced9 100644 --- a/ironic/drivers/modules/redfish/boot.py +++ b/ironic/drivers/modules/redfish/boot.py @@ -46,13 +46,8 @@ OPTIONAL_PROPERTIES = { "driver should use virtual media USB or 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."), + 'kernel_append_params': driver_utils.KERNEL_APPEND_PARAMS_DESCRIPTION % + {'option_group': 'redfish'}, '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 " diff --git a/ironic/drivers/utils.py b/ironic/drivers/utils.py index 5e1596eb4..fc5cdcf0d 100644 --- a/ironic/drivers/utils.py +++ b/ironic/drivers/utils.py @@ -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): """Get the applicable kernel params. @@ -399,7 +410,7 @@ def get_kernel_append_params(node, default): for location in ('instance_info', 'driver_info'): result = getattr(node, location).get('kernel_append_params') if result is not None: - return result + return result.replace('%default%', default or '') return default |