Add --concurrency argument to introspect commands
The default concurrency of 20 may be too high for small underclouds (especially CI environments), so this change adds a --concurrency argument so callers can control the maximum number of nodes to introspect concurrently. Depends-On: https://review.opendev.org/#/c/672389/ Change-Id: I9faee9ab133e34466a79aa1176a16106bda1f15d Closes-Bug: #1836976
This commit is contained in:
parent
7022d93e81
commit
3e03e3b78c
|
@ -269,7 +269,7 @@ class TestIntrospectNode(fakes.TestOvercloudNode):
|
|||
|
||||
call_list = [mock.call(
|
||||
'tripleo.baremetal.v1.introspect_manageable_nodes',
|
||||
workflow_input={'run_validations': False}
|
||||
workflow_input={'run_validations': False, 'concurrency': 20}
|
||||
)]
|
||||
|
||||
if provide:
|
||||
|
@ -294,7 +294,8 @@ class TestIntrospectNode(fakes.TestOvercloudNode):
|
|||
call_list = [mock.call(
|
||||
'tripleo.baremetal.v1.introspect', workflow_input={
|
||||
'node_uuids': nodes,
|
||||
'run_validations': False}
|
||||
'run_validations': False,
|
||||
'concurrency': 20}
|
||||
)]
|
||||
|
||||
if provide:
|
||||
|
@ -533,7 +534,8 @@ class TestImportNode(fakes.TestOvercloudNode):
|
|||
call_list.append(mock.call(
|
||||
'tripleo.baremetal.v1.introspect', workflow_input={
|
||||
'node_uuids': ['MOCK_NODE_UUID'],
|
||||
'run_validations': False}
|
||||
'run_validations': False,
|
||||
'concurrency': 20}
|
||||
))
|
||||
|
||||
if provide:
|
||||
|
@ -704,7 +706,8 @@ class TestImportNodeMultiArch(fakes.TestOvercloudNode):
|
|||
call_list.append(mock.call(
|
||||
'tripleo.baremetal.v1.introspect', workflow_input={
|
||||
'node_uuids': ['MOCK_NODE_UUID'],
|
||||
'run_validations': False}
|
||||
'run_validations': False,
|
||||
'concurrency': 20}
|
||||
))
|
||||
|
||||
if provide:
|
||||
|
@ -1011,12 +1014,14 @@ class TestDiscoverNode(fakes.TestOvercloudNode):
|
|||
'--credentials', 'admin2:password2',
|
||||
'--port', '623', '--port', '6230',
|
||||
'--introspect', '--provide', '--run-validations',
|
||||
'--no-deploy-image', '--instance-boot-option', 'netboot']
|
||||
'--no-deploy-image', '--instance-boot-option', 'netboot',
|
||||
'--concurrency', '10']
|
||||
verifylist = [('ip_addresses', '10.0.0.0/24'),
|
||||
('credentials', ['admin:password', 'admin2:password2']),
|
||||
('port', [623, 6230]),
|
||||
('introspect', True),
|
||||
('run_validations', True),
|
||||
('concurrency', 10),
|
||||
('provide', True),
|
||||
('no_deploy_image', True),
|
||||
('instance_boot_option', 'netboot')]
|
||||
|
@ -1035,7 +1040,8 @@ class TestDiscoverNode(fakes.TestOvercloudNode):
|
|||
'instance_boot_option': 'netboot'}),
|
||||
mock.call('tripleo.baremetal.v1.introspect',
|
||||
workflow_input={'node_uuids': ['MOCK_NODE_UUID'],
|
||||
'run_validations': True}),
|
||||
'run_validations': True,
|
||||
'concurrency': 10}),
|
||||
mock.call('tripleo.baremetal.v1.provide',
|
||||
workflow_input={'node_uuids': ['MOCK_NODE_UUID']}
|
||||
)
|
||||
|
|
|
@ -144,13 +144,14 @@ class TestBaremetalWorkflows(utils.TestCommand):
|
|||
self.websocket.wait_for_messages.return_value = self.message_success
|
||||
|
||||
baremetal.introspect(self.app.client_manager, node_uuids=[],
|
||||
run_validations=True)
|
||||
run_validations=True, concurrency=20)
|
||||
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
'tripleo.baremetal.v1.introspect',
|
||||
workflow_input={
|
||||
'node_uuids': [],
|
||||
'run_validations': True,
|
||||
'concurrency': 20
|
||||
})
|
||||
|
||||
def test_introspect_error(self):
|
||||
|
@ -162,7 +163,8 @@ class TestBaremetalWorkflows(utils.TestCommand):
|
|||
baremetal.introspect,
|
||||
self.app.client_manager,
|
||||
node_uuids=[],
|
||||
run_validations=False
|
||||
run_validations=False,
|
||||
concurrency=20
|
||||
)
|
||||
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
|
@ -170,6 +172,7 @@ class TestBaremetalWorkflows(utils.TestCommand):
|
|||
workflow_input={
|
||||
'node_uuids': [],
|
||||
'run_validations': False,
|
||||
'concurrency': 20
|
||||
})
|
||||
|
||||
def test_introspect_manageable_nodes_success(self):
|
||||
|
@ -181,12 +184,13 @@ class TestBaremetalWorkflows(utils.TestCommand):
|
|||
}])
|
||||
|
||||
baremetal.introspect_manageable_nodes(
|
||||
self.app.client_manager, run_validations=False
|
||||
self.app.client_manager, run_validations=False, concurrency=20
|
||||
)
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
'tripleo.baremetal.v1.introspect_manageable_nodes',
|
||||
workflow_input={
|
||||
'run_validations': False,
|
||||
'concurrency': 20
|
||||
})
|
||||
|
||||
def test_introspect_manageable_nodes_error(self):
|
||||
|
@ -197,13 +201,15 @@ class TestBaremetalWorkflows(utils.TestCommand):
|
|||
exceptions.IntrospectionError,
|
||||
baremetal.introspect_manageable_nodes,
|
||||
self.app.client_manager,
|
||||
run_validations=False
|
||||
run_validations=False,
|
||||
concurrency=20
|
||||
)
|
||||
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
'tripleo.baremetal.v1.introspect_manageable_nodes',
|
||||
workflow_input={
|
||||
'run_validations': False,
|
||||
'concurrency': 20
|
||||
})
|
||||
|
||||
def test_introspect_manageable_nodes_mixed_status(self):
|
||||
|
@ -219,13 +225,15 @@ class TestBaremetalWorkflows(utils.TestCommand):
|
|||
exceptions.IntrospectionError,
|
||||
baremetal.introspect_manageable_nodes,
|
||||
self.app.client_manager,
|
||||
run_validations=False
|
||||
run_validations=False,
|
||||
concurrency=20
|
||||
)
|
||||
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
'tripleo.baremetal.v1.introspect_manageable_nodes',
|
||||
workflow_input={
|
||||
'run_validations': False,
|
||||
'concurrency': 20
|
||||
})
|
||||
|
||||
def test_provide_manageable_nodes_success(self):
|
||||
|
|
|
@ -209,6 +209,10 @@ class IntrospectNode(command.Command):
|
|||
help=_('Run the pre-deployment validations. These '
|
||||
'external validations are from the TripleO '
|
||||
'Validations project.'))
|
||||
parser.add_argument('--concurrency', type=int,
|
||||
default=20,
|
||||
help=_('Maximum number of nodes to introspect at '
|
||||
'once.'))
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
|
@ -219,12 +223,14 @@ class IntrospectNode(command.Command):
|
|||
if nodes:
|
||||
baremetal.introspect(self.app.client_manager,
|
||||
node_uuids=nodes,
|
||||
run_validations=parsed_args.run_validations
|
||||
run_validations=parsed_args.run_validations,
|
||||
concurrency=parsed_args.concurrency
|
||||
)
|
||||
else:
|
||||
baremetal.introspect_manageable_nodes(
|
||||
self.app.client_manager,
|
||||
run_validations=parsed_args.run_validations
|
||||
run_validations=parsed_args.run_validations,
|
||||
concurrency=parsed_args.concurrency
|
||||
)
|
||||
|
||||
if parsed_args.provide:
|
||||
|
@ -275,6 +281,10 @@ class ImportNode(command.Command):
|
|||
constants.IRONIC_HTTP_BOOT_BIND_MOUNT),
|
||||
help=_("Root directory for the ironic-python-agent"
|
||||
" image"))
|
||||
parser.add_argument('--concurrency', type=int,
|
||||
default=20,
|
||||
help=_('Maximum number of nodes to introspect at '
|
||||
'once.'))
|
||||
parser.add_argument('env_file', type=argparse.FileType('r'))
|
||||
return parser
|
||||
|
||||
|
@ -303,7 +313,8 @@ class ImportNode(command.Command):
|
|||
if parsed_args.introspect:
|
||||
baremetal.introspect(self.app.client_manager,
|
||||
node_uuids=nodes_uuids,
|
||||
run_validations=parsed_args.run_validations
|
||||
run_validations=parsed_args.run_validations,
|
||||
concurrency=parsed_args.concurrency
|
||||
)
|
||||
|
||||
if parsed_args.provide:
|
||||
|
@ -425,6 +436,10 @@ class DiscoverNode(command.Command):
|
|||
help=_('Whether to set instances for booting from '
|
||||
'local hard drive (local) or network '
|
||||
'(netboot).'))
|
||||
parser.add_argument('--concurrency', type=int,
|
||||
default=20,
|
||||
help=_('Maximum number of nodes to introspect at '
|
||||
'once.'))
|
||||
return parser
|
||||
|
||||
# FIXME(tonyb): This is not multi-arch safe :(
|
||||
|
@ -459,7 +474,8 @@ class DiscoverNode(command.Command):
|
|||
if parsed_args.introspect:
|
||||
baremetal.introspect(self.app.client_manager,
|
||||
node_uuids=nodes_uuids,
|
||||
run_validations=parsed_args.run_validations
|
||||
run_validations=parsed_args.run_validations,
|
||||
concurrency=parsed_args.concurrency
|
||||
)
|
||||
if parsed_args.provide:
|
||||
baremetal.provide(self.app.client_manager,
|
||||
|
|
|
@ -146,7 +146,9 @@ def introspect(clients, **workflow_input):
|
|||
'tripleo.baremetal.v1.introspect',
|
||||
workflow_input={
|
||||
'node_uuids': workflow_input['node_uuids'],
|
||||
'run_validations': workflow_input['run_validations']}
|
||||
'run_validations': workflow_input['run_validations'],
|
||||
'concurrency': workflow_input.get('concurrency', 20)
|
||||
}
|
||||
)
|
||||
|
||||
for payload in base.wait_for_messages(workflow_client, ws, execution):
|
||||
|
@ -177,7 +179,9 @@ def introspect_manageable_nodes(clients, **workflow_input):
|
|||
workflow_client,
|
||||
'tripleo.baremetal.v1.introspect_manageable_nodes',
|
||||
workflow_input={
|
||||
'run_validations': workflow_input['run_validations']}
|
||||
'run_validations': workflow_input['run_validations'],
|
||||
'concurrency': workflow_input.get('concurrency', 20)
|
||||
}
|
||||
)
|
||||
|
||||
for payload in base.wait_for_messages(workflow_client, ws, execution):
|
||||
|
|
Loading…
Reference in New Issue