Merge "Add "erase_devices_metadata_priority" config option"

This commit is contained in:
Jenkins 2016-08-12 16:47:54 +00:00 committed by Gerrit Code Review
commit be492c4c29
9 changed files with 49 additions and 7 deletions

View File

@ -951,6 +951,13 @@
# set to 0, will not run during cleaning. (integer value)
#erase_devices_priority = <None>
# Priority to run in-band clean step that erases metadata from
# devices, via the Ironic Python Agent ramdisk. If unset, will
# use the priority set in the ramdisk (defaults to 99 for the
# GenericHardwareManager). If set to 0, will not run during
# cleaning. (integer value)
#erase_devices_metadata_priority = <None>
# During shred, overwrite all block devices N times with
# random data. This is only used if a device could not be ATA
# Secure Erased. Defaults to 1. (integer value)

View File

@ -32,6 +32,13 @@ opts = [
'set in the ramdisk (defaults to 10 for the '
'GenericHardwareManager). If set to 0, will not run '
'during cleaning.')),
cfg.IntOpt('erase_devices_metadata_priority',
help=_('Priority to run in-band clean step that erases '
'metadata from devices, via the Ironic Python Agent '
'ramdisk. If unset, will use the priority set in the '
'ramdisk (defaults to 99 for the '
'GenericHardwareManager). If set to 0, will not run '
'during cleaning.')),
# TODO(mmitchell): Remove the deprecated name/group during Ocata cycle.
cfg.IntOpt('shred_random_overwrite_iterations',
deprecated_name='erase_devices_iterations',

View File

@ -517,6 +517,8 @@ class AgentDeploy(AgentDeployMixin, base.DeployInterface):
"""
new_priorities = {
'erase_devices': CONF.deploy.erase_devices_priority,
'erase_devices_metadata':
CONF.deploy.erase_devices_metadata_priority,
}
return deploy_utils.agent_get_clean_steps(
task, interface='deploy',

View File

@ -299,6 +299,8 @@ class IloVirtualMediaAgentDeploy(agent.AgentDeploy):
new_priorities = {
'erase_devices': priority,
'erase_devices_metadata':
CONF.deploy.erase_devices_metadata_priority,
}
return deploy_utils.agent_get_clean_steps(
task, interface='deploy',

View File

@ -557,7 +557,9 @@ class ISCSIDeploy(AgentDeployMixin, base.DeployInterface):
steps = deploy_utils.agent_get_clean_steps(
task, interface='deploy',
override_priorities={
'erase_devices': CONF.deploy.erase_devices_priority})
'erase_devices': CONF.deploy.erase_devices_priority,
'erase_devices_metadata':
CONF.deploy.erase_devices_metadata_priority})
return steps
@METRICS.timer('ISCSIDeploy.execute_clean_step')

View File

@ -495,6 +495,7 @@ class IloVirtualMediaAgentDeployTestCase(db_base.DbTestCase):
autospec=True)
def test_get_clean_steps_with_conf_option(self, get_clean_step_mock):
self.config(clean_priority_erase_devices=20, group='ilo')
self.config(erase_devices_metadata_priority=10, group='deploy')
get_clean_step_mock.return_value = [{
'step': 'erase_devices',
'priority': 10,
@ -506,12 +507,14 @@ class IloVirtualMediaAgentDeployTestCase(db_base.DbTestCase):
task.driver.deploy.get_clean_steps(task)
get_clean_step_mock.assert_called_once_with(
task, interface='deploy',
override_priorities={'erase_devices': 20})
override_priorities={'erase_devices': 20,
'erase_devices_metadata': 10})
@mock.patch.object(deploy_utils, 'agent_get_clean_steps', spec_set=True,
autospec=True)
def test_get_clean_steps_erase_devices_disable(self, get_clean_step_mock):
self.config(clean_priority_erase_devices=0, group='ilo')
self.config(erase_devices_metadata_priority=0, group='deploy')
get_clean_step_mock.return_value = [{
'step': 'erase_devices',
'priority': 10,
@ -523,7 +526,8 @@ class IloVirtualMediaAgentDeployTestCase(db_base.DbTestCase):
task.driver.deploy.get_clean_steps(task)
get_clean_step_mock.assert_called_once_with(
task, interface='deploy',
override_priorities={'erase_devices': 0})
override_priorities={'erase_devices': 0,
'erase_devices_metadata': 0})
@mock.patch.object(deploy_utils, 'agent_get_clean_steps', spec_set=True,
autospec=True)
@ -539,7 +543,8 @@ class IloVirtualMediaAgentDeployTestCase(db_base.DbTestCase):
task.driver.deploy.get_clean_steps(task)
get_clean_step_mock.assert_called_once_with(
task, interface='deploy',
override_priorities={'erase_devices': None})
override_priorities={'erase_devices': None,
'erase_devices_metadata': None})
@mock.patch.object(agent.AgentDeploy, 'prepare_cleaning', spec_set=True,
autospec=True)

View File

@ -572,7 +572,8 @@ class TestAgentDeploy(db_base.DbTestCase):
steps = self.driver.get_clean_steps(task)
mock_get_clean_steps.assert_called_once_with(
task, interface='deploy',
override_priorities={'erase_devices': None})
override_priorities={'erase_devices': None,
'erase_devices_metadata': None})
self.assertEqual(mock_steps, steps)
@mock.patch('ironic.drivers.modules.deploy_utils.agent_get_clean_steps',
@ -581,6 +582,7 @@ class TestAgentDeploy(db_base.DbTestCase):
# 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
self.config(erase_devices_priority=0, group='deploy')
self.config(erase_devices_metadata_priority=0, group='deploy')
mock_steps = [{'priority': 10, 'interface': 'deploy',
'step': 'erase_devices'}]
mock_get_clean_steps.return_value = mock_steps
@ -588,7 +590,8 @@ class TestAgentDeploy(db_base.DbTestCase):
self.driver.get_clean_steps(task)
mock_get_clean_steps.assert_called_once_with(
task, interface='deploy',
override_priorities={'erase_devices': 0})
override_priorities={'erase_devices': 0,
'erase_devices_metadata': 0})
@mock.patch.object(deploy_utils, 'prepare_inband_cleaning', autospec=True)
def test_prepare_cleaning(self, prepare_inband_cleaning_mock):

View File

@ -638,6 +638,7 @@ class ISCSIDeployTestCase(db_base.DbTestCase):
def test_get_clean_steps(self, mock_get_clean_steps):
# Test getting clean steps
self.config(group='deploy', erase_devices_priority=10)
self.config(group='deploy', erase_devices_metadata_priority=5)
mock_steps = [{'priority': 10, 'interface': 'deploy',
'step': 'erase_devices'}]
self.node.driver_internal_info = {'agent_url': 'foo'}
@ -648,7 +649,8 @@ class ISCSIDeployTestCase(db_base.DbTestCase):
mock_get_clean_steps.assert_called_once_with(
task, interface='deploy',
override_priorities={
'erase_devices': 10})
'erase_devices': 10,
'erase_devices_metadata': 5})
self.assertEqual(mock_steps, steps)
@mock.patch.object(deploy_utils, 'agent_execute_clean_step', autospec=True)

View File

@ -0,0 +1,12 @@
---
features:
- Adds a new ``[deploy]/erase_devices_metadata_priority`` configuration
option to allow operators to configure the priority (or disable) of the
"erase_devices_metadata" cleaning step.
upgrade:
- The new "erase_devices_metadata" cleaning step is enabled by
default (if available) in the ironic-python-agent project (priority
99). Wiping the devices metadata is usually very fast and shouldn't
add much time (if any) to the overall cleaning process. Operators
wanting to disable this cleaning step can do it by setting the
``[deploy]/erase_devices_metadata_priority`` configuration option to 0.