Merge "dedup reboot request in redfish bios path"
This commit is contained in:
commit
c44d30664b
@ -164,7 +164,7 @@ class RedfishBIOS(base.BIOSInterface):
|
||||
|
||||
node = task.node
|
||||
info = node.driver_internal_info
|
||||
reboot_requested = info.get('post_factory_reset_reboot_requested')
|
||||
reboot_requested = info.get('post_bios_reboot_requested')
|
||||
if not reboot_requested:
|
||||
LOG.debug('Factory reset BIOS configuration for node %(node)s',
|
||||
{'node': node.uuid})
|
||||
@ -177,7 +177,7 @@ class RedfishBIOS(base.BIOSInterface):
|
||||
LOG.error(error_msg)
|
||||
raise exception.RedfishError(error=error_msg)
|
||||
|
||||
self._set_reboot(task)
|
||||
self._set_reboot_requested(task, None)
|
||||
return self.post_reset(task)
|
||||
else:
|
||||
current_attrs = bios.attributes
|
||||
@ -213,7 +213,7 @@ class RedfishBIOS(base.BIOSInterface):
|
||||
attributes = {s['name']: s['value'] for s in settings}
|
||||
|
||||
info = task.node.driver_internal_info
|
||||
reboot_requested = info.get('post_config_reboot_requested')
|
||||
reboot_requested = info.get('post_bios_reboot_requested')
|
||||
|
||||
if not reboot_requested:
|
||||
# Step 1: Apply settings and issue a reboot
|
||||
@ -315,26 +315,17 @@ class RedfishBIOS(base.BIOSInterface):
|
||||
LOG.debug('Verification of BIOS settings for node %(node_uuid)s '
|
||||
'successful.', {'node_uuid': task.node.uuid})
|
||||
|
||||
def _set_reboot(self, task):
|
||||
"""Set driver_internal_info flags for deployment or cleaning reboot.
|
||||
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
"""
|
||||
task.node.set_driver_internal_info(
|
||||
'post_factory_reset_reboot_requested', True)
|
||||
task.node.save()
|
||||
deploy_utils.set_async_step_flags(task.node, reboot=True,
|
||||
skip_current_step=False)
|
||||
|
||||
def _set_reboot_requested(self, task, attributes):
|
||||
"""Set driver_internal_info flags for reboot requested.
|
||||
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
:param attributes: the requested BIOS attributes to update.
|
||||
"""
|
||||
task.node.set_driver_internal_info('post_config_reboot_requested',
|
||||
task.node.set_driver_internal_info('post_bios_reboot_requested',
|
||||
True)
|
||||
task.node.set_driver_internal_info('requested_bios_attrs', attributes)
|
||||
if attributes:
|
||||
task.node.set_driver_internal_info('requested_bios_attrs',
|
||||
attributes)
|
||||
task.node.save()
|
||||
deploy_utils.set_async_step_flags(task.node, reboot=True,
|
||||
skip_current_step=False)
|
||||
@ -345,8 +336,7 @@ class RedfishBIOS(base.BIOSInterface):
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
"""
|
||||
node = task.node
|
||||
node.del_driver_internal_info('post_config_reboot_requested')
|
||||
node.del_driver_internal_info('post_factory_reset_reboot_requested')
|
||||
node.del_driver_internal_info('post_bios_reboot_requested')
|
||||
node.del_driver_internal_info('requested_bios_attrs')
|
||||
node.save()
|
||||
|
||||
|
@ -175,10 +175,8 @@ class RedfishBiosTestCase(db_base.DbTestCase):
|
||||
expected_ret = states.DEPLOYWAIT
|
||||
data = step_data['argsinfo'].get('settings', None)
|
||||
step = step_data['step']
|
||||
if step == 'factory_reset':
|
||||
check_fields.append('post_factory_reset_reboot_requested')
|
||||
elif step == 'apply_configuration':
|
||||
check_fields.append('post_config_reboot_requested')
|
||||
check_fields.append('post_bios_reboot_requested')
|
||||
if step == 'apply_configuration':
|
||||
attributes = {s['name']: s['value'] for s in data}
|
||||
mock_build_agent_options.return_value = {'a': 'b'}
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
@ -263,8 +261,7 @@ class RedfishBiosTestCase(db_base.DbTestCase):
|
||||
step_data = self.node.clean_step
|
||||
data = step_data['argsinfo'].get('settings', None)
|
||||
step = step_data['step']
|
||||
if step == 'factory_reset':
|
||||
check_fields = ['post_factory_reset_reboot_requested']
|
||||
check_fields = ['post_bios_reboot_requested']
|
||||
if step == 'apply_configuration':
|
||||
mock_bios = mock.Mock()
|
||||
# if attributes after reboot not provided then mimic success
|
||||
@ -275,8 +272,7 @@ class RedfishBiosTestCase(db_base.DbTestCase):
|
||||
mock_system = mock.Mock()
|
||||
mock_system.bios = mock_bios
|
||||
mock_get_system.return_value = mock_system
|
||||
check_fields = ['post_config_reboot_requested',
|
||||
'requested_bios_attrs']
|
||||
check_fields.append('requested_bios_attrs')
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
shared=False) as task:
|
||||
if step == 'factory_reset':
|
||||
@ -293,7 +289,7 @@ class RedfishBiosTestCase(db_base.DbTestCase):
|
||||
'step': 'factory_reset', 'argsinfo': {}}
|
||||
node = self.node
|
||||
driver_internal_info = node.driver_internal_info
|
||||
driver_internal_info['post_factory_reset_reboot_requested'] = True
|
||||
driver_internal_info['post_bios_reboot_requested'] = True
|
||||
node.driver_internal_info = driver_internal_info
|
||||
node.save()
|
||||
self._test_step_post_reboot()
|
||||
@ -303,7 +299,7 @@ class RedfishBiosTestCase(db_base.DbTestCase):
|
||||
'step': 'factory_reset', 'argsinfo': {}}
|
||||
node = self.node
|
||||
driver_internal_info = node.driver_internal_info
|
||||
driver_internal_info['post_factory_reset_reboot_requested'] = True
|
||||
driver_internal_info['post_bios_reboot_requested'] = True
|
||||
node.driver_internal_info = driver_internal_info
|
||||
node.save()
|
||||
self._test_step_post_reboot()
|
||||
@ -322,7 +318,7 @@ class RedfishBiosTestCase(db_base.DbTestCase):
|
||||
'NicBoot1': 'NetworkBoot'}
|
||||
node = self.node
|
||||
driver_internal_info = node.driver_internal_info
|
||||
driver_internal_info['post_config_reboot_requested'] = True
|
||||
driver_internal_info['post_bios_reboot_requested'] = True
|
||||
driver_internal_info['requested_bios_attrs'] = requested_attrs
|
||||
self.node.driver_internal_info = driver_internal_info
|
||||
self.node.save()
|
||||
@ -342,7 +338,7 @@ class RedfishBiosTestCase(db_base.DbTestCase):
|
||||
attributes_after_reboot = {'ProcTurboMode': 'Disabled'}
|
||||
node = self.node
|
||||
driver_internal_info = node.driver_internal_info
|
||||
driver_internal_info['post_config_reboot_requested'] = True
|
||||
driver_internal_info['post_bios_reboot_requested'] = True
|
||||
driver_internal_info['requested_bios_attrs'] = requested_attrs
|
||||
self.node.driver_internal_info = driver_internal_info
|
||||
self.node.provision_state = states.CLEANING
|
||||
@ -363,7 +359,7 @@ class RedfishBiosTestCase(db_base.DbTestCase):
|
||||
'NicBoot1': 'NetworkBoot'}
|
||||
node = self.node
|
||||
driver_internal_info = node.driver_internal_info
|
||||
driver_internal_info['post_config_reboot_requested'] = True
|
||||
driver_internal_info['post_bios_reboot_requested'] = True
|
||||
driver_internal_info['requested_bios_attrs'] = requested_attrs
|
||||
self.node.driver_internal_info = driver_internal_info
|
||||
self.node.save()
|
||||
@ -381,7 +377,7 @@ class RedfishBiosTestCase(db_base.DbTestCase):
|
||||
attributes_after_reboot = {'ProcTurboMode': 'Disabled'}
|
||||
node = self.node
|
||||
driver_internal_info = node.driver_internal_info
|
||||
driver_internal_info['post_config_reboot_requested'] = True
|
||||
driver_internal_info['post_bios_reboot_requested'] = True
|
||||
driver_internal_info['requested_bios_attrs'] = requested_attrs
|
||||
self.node.driver_internal_info = driver_internal_info
|
||||
self.node.provision_state = states.DEPLOYWAIT
|
||||
@ -432,7 +428,7 @@ class RedfishBiosTestCase(db_base.DbTestCase):
|
||||
shared=False) as task:
|
||||
attributes = mock_get_system(task.node).bios.attributes
|
||||
task.node.driver_internal_info[
|
||||
'post_config_reboot_requested'] = True
|
||||
'post_bios_reboot_requested'] = True
|
||||
task.node.driver_internal_info[
|
||||
'requested_bios_attrs'] = requested_attrs
|
||||
task.driver.bios._check_bios_attrs = mock.MagicMock()
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
If you upgrade while running a redfish interface based BIOS job, you job
|
||||
may not complete due to a change in the internal state variables stored.
|
||||
Ensure none of these operations are in flight when upgrading.
|
Loading…
Reference in New Issue
Block a user