Add --boot-mode to import and configure

The commands `openstack overcloud node import` and `openstack
overcloud node configure` now have a --boot-mode arguement which
allows the boot mode for all affected nodes to be set to UEFI boot
(uefi) or legacy BIOS boot (bios).

It is expected --boot-mode=bios will only be required when specific
nodes have issues with UEFI boot, or on architectures which don't
support it (Power)

Change-Id: Idee25f23652a8e7435a31842d4a2d838543607ae
Depends-On: https://review.opendev.org/c/openstack/tripleo-heat-templates/+/805732
Blueprint: whole-disk-default
changes/33/805733/2
Steve Baker 1 year ago
parent 0208f3f49b
commit ae6958a862
  1. 7
      releasenotes/notes/boot_mode-ef25d1a032dcae56.yaml
  2. 6
      tripleoclient/v1/overcloud_node.py
  3. 9
      tripleoclient/v2/overcloud_node.py
  4. 28
      tripleoclient/workflows/baremetal.py

@ -0,0 +1,7 @@
---
features:
- |
The commands `openstack overcloud node import` and `openstack overcloud node
configure` now have a --boot-mode arguement which allows the boot mode for
all affected nodes to be set to UEFI boot (uefi) or legacy BIOS boot (bios).
This allows some nodes to have a different boot mode to the default (uefi).

@ -308,6 +308,10 @@ class ConfigureNode(command.Command):
help=_('Whether to set instances for booting from '
'local hard drive (local) or network '
'(netboot).'))
parser.add_argument('--boot-mode',
choices=['uefi', 'bios'],
help=_('Whether to set the boot mode to UEFI '
'(uefi) or legacy BIOS (bios)'))
parser.add_argument('--root-device',
help=_('Define the root device for nodes. '
'Can be either a list of device names '
@ -335,6 +339,7 @@ class ConfigureNode(command.Command):
kernel_name=parsed_args.deploy_kernel,
ramdisk_name=parsed_args.deploy_ramdisk,
instance_boot_option=parsed_args.instance_boot_option,
boot_mode=parsed_args.boot_mode,
root_device=parsed_args.root_device,
root_device_minimum_size=parsed_args.root_device_minimum_size,
overwrite_root_device_hints=(
@ -346,6 +351,7 @@ class ConfigureNode(command.Command):
kernel_name=parsed_args.deploy_kernel,
ramdisk_name=parsed_args.deploy_ramdisk,
instance_boot_option=parsed_args.instance_boot_option,
boot_mode=parsed_args.boot_mode,
root_device=parsed_args.root_device,
root_device_minimum_size=parsed_args.root_device_minimum_size,
overwrite_root_device_hints=(

@ -73,7 +73,11 @@ class ImportNode(command.Command):
choices=['local', 'netboot'], default=None,
help=_('Whether to set instances for booting from'
' local hard drive (local) or network '
' (netboot).'))
' (netboot)'))
parser.add_argument('--boot-mode',
choices=['uefi', 'bios'], default=None,
help=_('Whether to set the boot mode to UEFI '
'(uefi) or legacy BIOS (bios)'))
parser.add_argument("--http-boot",
default=os.environ.get(
'HTTP_BOOT',
@ -105,7 +109,8 @@ class ImportNode(command.Command):
nodes = baremetal.register_or_update(
self.app.client_manager,
nodes_json=nodes_config,
instance_boot_option=parsed_args.instance_boot_option
instance_boot_option=parsed_args.instance_boot_option,
boot_mode=parsed_args.boot_mode
)
nodes_uuids = [node.uuid for node in nodes]

@ -48,7 +48,8 @@ def validate_nodes(clients, nodes_json):
def register_or_update(clients, nodes_json, kernel_name=None,
ramdisk_name=None, instance_boot_option=None):
ramdisk_name=None, instance_boot_option=None,
boot_mode=None):
"""Node Registration or Update
:param clients: Application client object.
@ -67,6 +68,9 @@ def register_or_update(clients, nodes_json, kernel_name=None,
local hard drive (local) or network
(netboot).
:type instance_boot_option: String
:param boot_mode: Whether to set the boot mode to UEFI (uefi) or legacy
BIOS (bios)
:type boot_mode: String
:returns: List
"""
@ -74,8 +78,10 @@ def register_or_update(clients, nodes_json, kernel_name=None,
for node in nodes_json:
caps = node.get('capabilities', {})
caps = node_utils.capabilities_to_dict(caps)
if instance_boot_option is not None:
if instance_boot_option:
caps.setdefault('boot_option', instance_boot_option)
if boot_mode:
caps.setdefault('boot_mode', boot_mode)
node['capabilities'] = node_utils.dict_to_capabilities(caps)
registered_nodes = node_utils.register_all_nodes(
@ -229,7 +235,8 @@ def introspect_manageable_nodes(clients, run_validations, concurrency,
def _configure_boot(clients, node_uuid,
kernel_name=None,
ramdisk_name=None,
instance_boot_option=None):
instance_boot_option=None,
boot_mode=None):
baremetal_client = clients.baremetal
image_ids = {'kernel': kernel_name, 'ramdisk': ramdisk_name}
node = baremetal_client.node.get(node_uuid)
@ -237,6 +244,8 @@ def _configure_boot(clients, node_uuid,
capabilities = node_utils.capabilities_to_dict(capabilities)
if instance_boot_option is not None:
capabilities['boot_option'] = instance_boot_option
if boot_mode is not None:
capabilities['boot_mode'] = boot_mode
capabilities = node_utils.dict_to_capabilities(capabilities)
baremetal_client.node.update(node.uuid, [
@ -363,7 +372,7 @@ def _apply_root_device_strategy(clients, node_uuid, strategy,
def configure(clients, node_uuids, kernel_name=None,
ramdisk_name=None, instance_boot_option=None,
root_device=None, root_device_minimum_size=4,
boot_mode=None, root_device=None, root_device_minimum_size=4,
overwrite_root_device_hints=False):
"""Configure Node boot options.
@ -379,6 +388,9 @@ def configure(clients, node_uuids, kernel_name=None,
:param instance_boot_option: Boot options to use
:type instance_boot_option: String
:param boot_mode: Boot mode to use
:type instance_boot_option: String
:param root_device: Path (name) of the root device.
:type root_device: String
@ -393,7 +405,7 @@ def configure(clients, node_uuids, kernel_name=None,
for node_uuid in node_uuids:
_configure_boot(clients, node_uuid, kernel_name,
ramdisk_name, instance_boot_option)
ramdisk_name, instance_boot_option, boot_mode)
if root_device:
_apply_root_device_strategy(
clients, node_uuid,
@ -405,7 +417,7 @@ def configure(clients, node_uuids, kernel_name=None,
def configure_manageable_nodes(clients, kernel_name='bm-deploy-kernel',
ramdisk_name='bm-deploy-ramdisk',
instance_boot_option=None,
instance_boot_option=None, boot_mode=None,
root_device=None, root_device_minimum_size=4,
overwrite_root_device_hints=False):
"""Configure all manageable Nodes.
@ -426,6 +438,9 @@ def configure_manageable_nodes(clients, kernel_name='bm-deploy-kernel',
:param instance_boot_option: Boot options to use
:type instance_boot_option: String
:param boot_mode: Boot mode to use
:type instance_boot_option: String
:param root_device: Path (name) of the root device.
:type root_device: String
@ -447,6 +462,7 @@ def configure_manageable_nodes(clients, kernel_name='bm-deploy-kernel',
kernel_name=kernel_name,
ramdisk_name=ramdisk_name,
instance_boot_option=instance_boot_option,
boot_mode=boot_mode,
root_device=root_device,
root_device_minimum_size=root_device_minimum_size,
overwrite_root_device_hints=overwrite_root_device_hints

Loading…
Cancel
Save