Prevent MissingAttribute error when supportedApplyTime missing
On some hardware, supportedApplyTime attribute may not be listed under Redfish BIOS settings URL. This patch adds handling of this case to prevent failure on attempt of updating BIOS settings. Change-Id: I40359973fd832146cb2b179bfa447a308078e83d
This commit is contained in:
parent
b4f8209b99
commit
f93712d7a6
@ -230,12 +230,16 @@ class RedfishBIOS(base.BIOSInterface):
|
||||
LOG.debug('Apply BIOS configuration for node %(node_uuid)s: '
|
||||
'%(settings)r', {'node_uuid': task.node.uuid,
|
||||
'settings': settings})
|
||||
|
||||
if bios.supported_apply_times and (
|
||||
sushy.APPLY_TIME_ON_RESET in bios.supported_apply_times):
|
||||
apply_time = sushy.APPLY_TIME_ON_RESET
|
||||
else:
|
||||
apply_time = None
|
||||
try:
|
||||
if bios.supported_apply_times and (
|
||||
sushy.APPLY_TIME_ON_RESET in
|
||||
bios.supported_apply_times):
|
||||
apply_time = sushy.APPLY_TIME_ON_RESET
|
||||
except AttributeError:
|
||||
LOG.warning('SupportedApplyTimes attribute missing for BIOS'
|
||||
' configuration on node %(node_uuid)s: ',
|
||||
{'node_uuid': task.node.uuid})
|
||||
|
||||
try:
|
||||
bios.set_attributes(attributes, apply_time=apply_time)
|
||||
|
@ -537,6 +537,27 @@ class RedfishBiosTestCase(db_base.DbTestCase):
|
||||
{s['name']: s['value'] for s in settings},
|
||||
apply_time=None)
|
||||
|
||||
@mock.patch.object(redfish_boot.RedfishVirtualMediaBoot, 'prepare_ramdisk',
|
||||
spec_set=True, autospec=True)
|
||||
@mock.patch.object(deploy_utils, 'build_agent_options', autospec=True)
|
||||
@mock.patch.object(redfish_utils, 'get_system', autospec=True)
|
||||
@mock.patch.object(manager_utils, 'node_power_action', autospec=True)
|
||||
def test_apply_configuration_no_apply_time_attr(
|
||||
self, mock_power_action, mock_get_system, mock_build_agent_options,
|
||||
mock_prepare):
|
||||
settings = [{'name': 'ProcTurboMode', 'value': 'Disabled'},
|
||||
{'name': 'NicBoot1', 'value': 'NetworkBoot'}]
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
shared=False) as task:
|
||||
bios = mock_get_system(task.node).bios
|
||||
del bios.supported_apply_times
|
||||
|
||||
task.driver.bios.apply_configuration(task, settings)
|
||||
|
||||
bios.set_attributes.assert_called_once_with(
|
||||
{s['name']: s['value'] for s in settings},
|
||||
apply_time=None)
|
||||
|
||||
|
||||
@mock.patch('oslo_utils.eventletutils.EventletEvent.wait',
|
||||
lambda *args, **kwargs: None)
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixes the bug where provisioning a Redfish managed node fails if changing
|
||||
BIOS settings is attempted on a BMC that doesn't provide
|
||||
supportedApplyTime information. This is done by adding handling of
|
||||
AttributeError exception in apply_configuration() method.
|
Loading…
Reference in New Issue
Block a user