diff --git a/ironic/conf/deploy.py b/ironic/conf/deploy.py index 0c763fd751..bf82f793b0 100644 --- a/ironic/conf/deploy.py +++ b/ironic/conf/deploy.py @@ -66,6 +66,13 @@ opts = [ 'node will be put in ``clean failed`` state. ' 'If True, shred will be invoked and cleaning will ' 'continue.')), + cfg.IntOpt('disk_erasure_concurrency', + default=1, + min=1, + help=_('Defines the target pool size used by Ironic Python ' + 'Agent ramdisk to erase disk devices. The number of ' + 'threads created to erase disks will not exceed this ' + 'value or the number of disks to be erased.')), cfg.BoolOpt('power_off_after_deploy_failure', default=True, help=_('Whether to power off a node after deploy failure. ' diff --git a/ironic/drivers/modules/deploy_utils.py b/ironic/drivers/modules/deploy_utils.py index 67d2852a38..ffa0ba7d15 100644 --- a/ironic/drivers/modules/deploy_utils.py +++ b/ironic/drivers/modules/deploy_utils.py @@ -660,6 +660,7 @@ def agent_add_clean_params(task): info['agent_continue_if_ata_erase_failed'] = erase_fallback secure_erase = CONF.deploy.enable_ata_secure_erase info['agent_enable_ata_secure_erase'] = secure_erase + info['disk_erasure_concurrency'] = CONF.deploy.disk_erasure_concurrency task.node.driver_internal_info = info task.node.save() diff --git a/ironic/tests/unit/drivers/modules/test_deploy_utils.py b/ironic/tests/unit/drivers/modules/test_deploy_utils.py index 4e09ee81fd..85bd3cd98e 100644 --- a/ironic/tests/unit/drivers/modules/test_deploy_utils.py +++ b/ironic/tests/unit/drivers/modules/test_deploy_utils.py @@ -1633,6 +1633,7 @@ class AgentMethodsTestCase(db_base.DbTestCase): cfg.CONF.set_override('continue_if_disk_secure_erase_fails', True, 'deploy') cfg.CONF.set_override('enable_ata_secure_erase', False, 'deploy') + cfg.CONF.set_override('disk_erasure_concurrency', 8, 'deploy') with task_manager.acquire( self.context, self.node.uuid, shared=False) as task: utils.agent_add_clean_params(task) @@ -1644,6 +1645,8 @@ class AgentMethodsTestCase(db_base.DbTestCase): 'agent_continue_if_ata_erase_failed']) self.assertIs(False, task.node.driver_internal_info[ 'agent_enable_ata_secure_erase']) + self.assertEqual(8, task.node.driver_internal_info[ + 'disk_erasure_concurrency']) @mock.patch.object(pxe.PXEBoot, 'prepare_ramdisk', autospec=True) @mock.patch('ironic.conductor.utils.node_power_action', autospec=True) diff --git a/releasenotes/notes/parallel-erasure-1943da9b53a2095d.yaml b/releasenotes/notes/parallel-erasure-1943da9b53a2095d.yaml new file mode 100644 index 0000000000..87505267aa --- /dev/null +++ b/releasenotes/notes/parallel-erasure-1943da9b53a2095d.yaml @@ -0,0 +1,9 @@ +--- +features: + - Adds a configuration option ``[deploy]disk_erasure_concurrency`` to + define the target pool size used by Ironic Python Agent ramdisk to + erase disk devices. The number of threads created by IPA to erase + disk devices is the minimum value of target pool size and the number of + disks to be erased. This feature can greatly reduce the operation time + for baremetals with multiple disks. For the backwards compatibility, + the default value is 1. \ No newline at end of file