Add extra_boot_params install value for subcloud installs

This commit adds support for the extra_boot_params install value. The
extra_boot_params install value provides a mechanism to pass custom boot
arguments into the main sysroot disk kernel options. The intent is to
allow for custom, hardware-specific boot option(s) for a given subcloud.

Note: these extra options are only applied for the post-miniboot boot,
i.e., when booting into the main ostree-based installation. The boot
arguments are NOT applied during the initial miniboot ISO boot.

Multiple boot arguments can be provided by separating each argument by a
single comma. Spaces are not allowed. Example install value (yaml snippet):

    extra_boot_params: arg1=val1,arg2=val2

The extra_boot_params value is included in the miniboot ISO boot
parameters in the form of 'extra_boot_params=arg1=val1,arg2=val2'.
When the subcloud boots, the miniboot kickstart translates
this parameter into proper grub/syslinux kernel options to be applied
for subsequent ostree-based boots.

Test Plan
PASS:
- Verify the extra_boot_params install value is translated into a boot
  parameter for initial miniboot ISO boots.
- Verify that any spaces in the extra_boot_params value are detected and
  an error is raised, aborting the subcloud installation.
- Verify an empty extra_boot_params value is ignored
- Verify that functionality is not affected if the extra_boot_params
  value is not provided
- Tested values:
    - Success:
      extra_boot_params: arg1=val1,arg2=val2
      extra_boot_params: arg1=val1
      extra_boot_params: arg1
      # extra_boot_params: arg1=val1,arg2=val2
    - Fail:
      extra_boot_params:
      extra_boot_params: arg1=val1, arg2=val2

Partial-Bug: 2023407

Change-Id: I183e07fbdef67cf5bac0da363b7f31d230e95bf5
Signed-off-by: Kyle MacLeod <kyle.macleod@windriver.com>
This commit is contained in:
Kyle MacLeod 2023-06-08 23:43:34 -04:00
parent fe1f26719c
commit 5d03d8915a
2 changed files with 23 additions and 0 deletions

View File

@ -67,6 +67,7 @@ OPTIONAL_INSTALL_VALUES = [
'no_check_certificate',
'persistent_size',
'hw_settle',
'extra_boot_params',
]
GEN_ISO_OPTIONS = {
@ -82,6 +83,7 @@ GEN_ISO_OPTIONS = {
'no_check_certificate': '--param',
'persistent_size': '--param',
'hw_settle': '--param',
'extra_boot_params': '--param',
}
BMC_OPTIONS = {
@ -383,6 +385,10 @@ class SubcloudInstall(object):
update_iso_cmd += [GEN_ISO_OPTIONS[key],
('insthwsettle=%s'
% str(values[key]))]
elif key == 'extra_boot_params':
update_iso_cmd += [GEN_ISO_OPTIONS[key],
('extra_boot_params=%s'
% str(values[key]))]
else:
update_iso_cmd += [GEN_ISO_OPTIONS[key], str(values[key])]

View File

@ -737,6 +737,23 @@ class SubcloudsController(object):
if hw_settle < 0:
pecan.abort(400, _("hw_settle of %s seconds is less than 0") %
(str(hw_settle)))
if 'extra_boot_params' in install_values:
# Validate 'extra_boot_params' boot parameter
# Note: this must be a single string (no spaces). If
# multiple boot parameters are required they can be
# separated by commas. They will be split into separate
# arguments by the miniboot.cfg kickstart.
extra_boot_params = install_values.get('extra_boot_params')
if extra_boot_params in ('', None, 'None'):
msg = "The install value extra_boot_params must not be empty."
pecan.abort(400, _(msg))
if ' ' in extra_boot_params:
msg = (
"Invalid install value 'extra_boot_params="
f"{extra_boot_params}'. Spaces are not allowed "
"(use ',' to separate multiple arguments)"
)
pecan.abort(400, _(msg))
for k in install_consts.MANDATORY_INSTALL_VALUES:
if k not in install_values: