Merge "Fix iLO drivers inconsistent boot mode default value"
This commit is contained in:
@@ -626,6 +626,11 @@ mode (Legacy BIOS or UEFI).
|
|||||||
|
|
||||||
* When boot mode capability is not configured:
|
* When boot mode capability is not configured:
|
||||||
|
|
||||||
|
- If config variable ``default_boot_mode`` in ``[ilo]`` section of
|
||||||
|
ironic configuration file is set to either 'bios' or 'uefi', then iLO
|
||||||
|
drivers use that boot mode for provisioning the baremetal ProLiant
|
||||||
|
servers.
|
||||||
|
|
||||||
- If the pending boot mode is set on the node then iLO drivers use that boot
|
- If the pending boot mode is set on the node then iLO drivers use that boot
|
||||||
mode for provisioning the baremetal ProLiant servers.
|
mode for provisioning the baremetal ProLiant servers.
|
||||||
|
|
||||||
|
@@ -1337,6 +1337,15 @@
|
|||||||
# CA certificate file to validate iLO. (string value)
|
# CA certificate file to validate iLO. (string value)
|
||||||
#ca_file = <None>
|
#ca_file = <None>
|
||||||
|
|
||||||
|
# Default boot mode to be used in provisioning when
|
||||||
|
# "boot_mode" capability is not provided in
|
||||||
|
# the"properties/capabilities" of the node. The default is
|
||||||
|
# "auto" for backward compatibility. When "auto" is specified,
|
||||||
|
# default boot mode will be selected based on boot mode
|
||||||
|
# settings on the system. (string value)
|
||||||
|
# Allowed values: auto, bios, uefi
|
||||||
|
#default_boot_mode = auto
|
||||||
|
|
||||||
|
|
||||||
[inspector]
|
[inspector]
|
||||||
|
|
||||||
|
@@ -80,6 +80,15 @@ opts = [
|
|||||||
'operations')),
|
'operations')),
|
||||||
cfg.StrOpt('ca_file',
|
cfg.StrOpt('ca_file',
|
||||||
help=_('CA certificate file to validate iLO.')),
|
help=_('CA certificate file to validate iLO.')),
|
||||||
|
cfg.StrOpt('default_boot_mode',
|
||||||
|
default='auto',
|
||||||
|
choices=['auto', 'bios', 'uefi'],
|
||||||
|
help=_('Default boot mode to be used in provisioning when '
|
||||||
|
'"boot_mode" capability is not provided in the'
|
||||||
|
'"properties/capabilities" of the node. The default is '
|
||||||
|
'"auto" for backward compatibility. When "auto" is '
|
||||||
|
'specified, default boot mode will be selected based '
|
||||||
|
'on boot mode settings on the system.')),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@@ -434,12 +434,22 @@ def update_boot_mode(task):
|
|||||||
node = task.node
|
node = task.node
|
||||||
boot_mode = deploy_utils.get_boot_mode_for_deploy(node)
|
boot_mode = deploy_utils.get_boot_mode_for_deploy(node)
|
||||||
|
|
||||||
if boot_mode is not None:
|
# No boot mode found. Check if default_boot_mode is defined
|
||||||
|
if not boot_mode and (CONF.ilo.default_boot_mode in ['bios', 'uefi']):
|
||||||
|
boot_mode = CONF.ilo.default_boot_mode
|
||||||
|
instance_info = node.instance_info
|
||||||
|
instance_info['deploy_boot_mode'] = boot_mode
|
||||||
|
node.instance_info = instance_info
|
||||||
|
node.save()
|
||||||
|
|
||||||
|
# Boot mode is computed, setting it for the deploy
|
||||||
|
if boot_mode:
|
||||||
LOG.debug("Node %(uuid)s boot mode is being set to %(boot_mode)s",
|
LOG.debug("Node %(uuid)s boot mode is being set to %(boot_mode)s",
|
||||||
{'uuid': node.uuid, 'boot_mode': boot_mode})
|
{'uuid': node.uuid, 'boot_mode': boot_mode})
|
||||||
set_boot_mode(node, boot_mode)
|
set_boot_mode(node, boot_mode)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Computing boot mode based on boot mode settings on bare metal
|
||||||
LOG.debug("Check pending boot mode for node %s.", node.uuid)
|
LOG.debug("Check pending boot mode for node %s.", node.uuid)
|
||||||
ilo_object = get_ilo_object(node)
|
ilo_object = get_ilo_object(node)
|
||||||
|
|
||||||
|
@@ -373,9 +373,22 @@ class IloCommonMethodsTestCase(db_base.DbTestCase):
|
|||||||
ilo_common.update_boot_mode(task)
|
ilo_common.update_boot_mode(task)
|
||||||
set_boot_mode_mock.assert_called_once_with(task.node, 'bios')
|
set_boot_mode_mock.assert_called_once_with(task.node, 'bios')
|
||||||
|
|
||||||
|
@mock.patch.object(ilo_common, 'set_boot_mode', spec_set=True,
|
||||||
|
autospec=True)
|
||||||
|
def test_update_boot_mode_use_def_boot_mode(self,
|
||||||
|
set_boot_mode_mock):
|
||||||
|
self.config(default_boot_mode='bios', group='ilo')
|
||||||
|
with task_manager.acquire(self.context, self.node.uuid,
|
||||||
|
shared=False) as task:
|
||||||
|
ilo_common.update_boot_mode(task)
|
||||||
|
set_boot_mode_mock.assert_called_once_with(task.node, 'bios')
|
||||||
|
self.assertEqual('bios',
|
||||||
|
task.node.instance_info['deploy_boot_mode'])
|
||||||
|
|
||||||
@mock.patch.object(ilo_common, 'get_ilo_object', spec_set=True,
|
@mock.patch.object(ilo_common, 'get_ilo_object', spec_set=True,
|
||||||
autospec=True)
|
autospec=True)
|
||||||
def test_update_boot_mode(self, get_ilo_object_mock):
|
def test_update_boot_mode(self, get_ilo_object_mock):
|
||||||
|
self.config(default_boot_mode="auto", group='ilo')
|
||||||
ilo_mock_obj = get_ilo_object_mock.return_value
|
ilo_mock_obj = get_ilo_object_mock.return_value
|
||||||
ilo_mock_obj.get_pending_boot_mode.return_value = 'LEGACY'
|
ilo_mock_obj.get_pending_boot_mode.return_value = 'LEGACY'
|
||||||
|
|
||||||
|
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- When no boot mode is explicitly set on a node using
|
||||||
|
an iLO driver, ironic automatically picks a boot
|
||||||
|
mode based on hardware capabilities. This confuses
|
||||||
|
deployers, as these factors are system specific and
|
||||||
|
not configurable. In order to ensure predictable
|
||||||
|
behavior, a new configuration parameter,
|
||||||
|
``[ilo]/default_boot_mode``, was added to allow
|
||||||
|
deployers to explicitly set a default. The default
|
||||||
|
value of this option keeps behavior consistent for
|
||||||
|
existing deployments.
|
Reference in New Issue
Block a user