Browse Source

Merge "Allow users to configure priority for {create,delete}_configuration"

changes/81/780481/1
Zuul 6 months ago
committed by Gerrit Code Review
parent
commit
f152ad370d
  1. 16
      ironic/conf/deploy.py
  2. 2
      ironic/drivers/modules/agent_base.py
  3. 12
      ironic/tests/unit/drivers/modules/test_agent.py
  4. 4
      ironic/tests/unit/drivers/modules/test_iscsi_deploy.py
  5. 4
      releasenotes/notes/add-clean-steps-priority-88d7de5973500a7d.yaml

16
ironic/conf/deploy.py

@ -55,6 +55,22 @@ opts = [
'ramdisk (defaults to 99 for the '
'GenericHardwareManager). If set to 0, will not run '
'during cleaning.')),
cfg.IntOpt('delete_configuration_priority',
mutable=True,
help=_('Priority to run in-band clean step that erases '
'RAID configuration from devices, via the Ironic '
'Python Agent ramdisk. If unset, will use the '
'priority set in the ramdisk (defaults to 0 for the '
'GenericHardwareManager). If set to 0, will not run '
'during cleaning.')),
cfg.IntOpt('create_configuration_priority',
mutable=True,
help=_('Priority to run in-band clean step that creates '
'RAID configuration from devices, via the Ironic '
'Python Agent ramdisk. If unset, will use the '
'priority set in the ramdisk (defaults to 0 for the '
'GenericHardwareManager). If set to 0, will not run '
'during cleaning.')),
cfg.IntOpt('shred_random_overwrite_iterations',
default=1,
min=0,

2
ironic/drivers/modules/agent_base.py

@ -852,6 +852,8 @@ class AgentDeployMixin(HeartbeatMixin, AgentOobStepsMixin):
'erase_devices': CONF.deploy.erase_devices_priority,
'erase_devices_metadata':
CONF.deploy.erase_devices_metadata_priority,
'delete_configuration': CONF.deploy.delete_configuration_priority,
'create_configuration': CONF.deploy.create_configuration_priority
}
return get_steps(
task, 'clean', interface='deploy',

12
ironic/tests/unit/drivers/modules/test_agent.py

@ -1163,15 +1163,21 @@ class TestAgentDeploy(db_base.DbTestCase):
mock_get_steps.assert_called_once_with(
task, 'clean', interface='deploy',
override_priorities={'erase_devices': None,
'erase_devices_metadata': None})
'erase_devices_metadata': None,
'delete_configuration': None,
'create_configuration': None})
self.assertEqual(mock_steps, steps)
@mock.patch.object(agent_base, 'get_steps', autospec=True)
def test_get_clean_steps_config_priority(self, mock_get_steps):
# Test that we can override the priority of get clean steps
# Use 0 because it is an edge case (false-y) and used in devstack
# for erase_devices, and 42 for RAID cleaning steps as they are
# disabled by default.
self.config(erase_devices_priority=0, group='deploy')
self.config(erase_devices_metadata_priority=0, group='deploy')
self.config(delete_configuration_priority=42, group='deploy')
self.config(create_configuration_priority=42, group='deploy')
mock_steps = [{'priority': 10, 'interface': 'deploy',
'step': 'erase_devices'}]
mock_get_steps.return_value = mock_steps
@ -1180,7 +1186,9 @@ class TestAgentDeploy(db_base.DbTestCase):
mock_get_steps.assert_called_once_with(
task, 'clean', interface='deploy',
override_priorities={'erase_devices': 0,
'erase_devices_metadata': 0})
'erase_devices_metadata': 0,
'delete_configuration': 42,
'create_configuration': 42})
@mock.patch.object(deploy_utils, 'prepare_inband_cleaning', autospec=True)
def test_prepare_cleaning(self, prepare_inband_cleaning_mock):

4
ironic/tests/unit/drivers/modules/test_iscsi_deploy.py

@ -980,7 +980,9 @@ class ISCSIDeployTestCase(db_base.DbTestCase):
task, 'clean', interface='deploy',
override_priorities={
'erase_devices': 10,
'erase_devices_metadata': 5})
'erase_devices_metadata': 5,
'delete_configuration': None,
'create_configuration': None})
self.assertEqual(mock_steps, steps)
@mock.patch.object(agent_base, 'execute_step', autospec=True)

4
releasenotes/notes/add-clean-steps-priority-88d7de5973500a7d.yaml

@ -0,0 +1,4 @@
---
features:
- It is now possible to configure a priority for both the delete and create
configuration RAID cleaning steps which are disabled by default.
Loading…
Cancel
Save