Merge "Add CLI options for introspection command"

This commit is contained in:
Zuul 2020-07-02 15:33:10 +00:00 committed by Gerrit Code Review
commit ccb9019d09
5 changed files with 65 additions and 10 deletions

View File

@ -178,7 +178,10 @@ class TestIntrospectNode(fakes.TestOvercloudNode):
extra_vars={
'node_uuids': [],
'run_validations': False,
'concurrency': 20
'concurrency': 20,
'node_timeout': 1200,
'max_retries': 1,
'retry_timeout': 120,
}
)
@ -219,7 +222,10 @@ class TestIntrospectNode(fakes.TestOvercloudNode):
extra_vars={
'node_uuids': nodes,
'run_validations': False,
'concurrency': 20
'concurrency': 20,
'node_timeout': 1200,
'max_retries': 1,
'retry_timeout': 120,
}
)

View File

@ -53,11 +53,14 @@ class TestBaremetalWorkflows(fakes.FakePlaybookExecution):
def test_introspect_success(self):
baremetal.introspect(self.app.client_manager, node_uuids=[],
run_validations=True, concurrency=20)
run_validations=True, concurrency=20,
node_timeout=1200, max_retries=1,
retry_timeout=120)
def test_introspect_manageable_nodes_success(self):
baremetal.introspect_manageable_nodes(
self.app.client_manager, run_validations=False, concurrency=20
self.app.client_manager, run_validations=False, concurrency=20,
node_timeout=1200, max_retries=1, retry_timeout=120,
)
def test_provide_manageable_nodes_success(self):

View File

@ -394,6 +394,16 @@ class DiscoverNode(command.Command):
default=20,
help=_('Maximum number of nodes to introspect at '
'once.'))
parser.add_argument('--node-timeout', type=int,
default=1200,
help=_('Maximum timeout for node introspection.'))
parser.add_argument('--max-retries', type=int,
default=1,
help=_('Maximum introspection retries.'))
parser.add_argument('--retry-timeout', type=int,
default=120,
help=_('Maximum timeout between introspection'
'retries'))
return parser
# FIXME(tonyb): This is not multi-arch safe :(
@ -434,7 +444,10 @@ class DiscoverNode(command.Command):
self.app.client_manager,
node_uuids=nodes_uuids,
run_validations=parsed_args.run_validations,
concurrency=parsed_args.concurrency
concurrency=parsed_args.concurrency,
node_timeout=parsed_args.node_timeout,
max_retries=parsed_args.max_retries,
retry_timeout=parsed_args.retry_timeout,
)
if parsed_args.provide:

View File

@ -164,6 +164,16 @@ class IntrospectNode(command.Command):
default=20,
help=_('Maximum number of nodes to introspect at '
'once.'))
parser.add_argument('--node-timeout', type=int,
default=1200,
help=_('Maximum timeout for node introspection.'))
parser.add_argument('--max-retries', type=int,
default=1,
help=_('Maximum introspection retries.'))
parser.add_argument('--retry-timeout', type=int,
default=120,
help=_('Maximum timeout between introspection'
'retries'))
return parser
def take_action(self, parsed_args):
@ -174,6 +184,9 @@ class IntrospectNode(command.Command):
self.app.client_manager,
run_validations=parsed_args.run_validations,
concurrency=parsed_args.concurrency,
node_timeout=parsed_args.node_timeout,
max_retries=parsed_args.max_retries,
retry_timeout=parsed_args.retry_timeout,
verbosity=oooutils.playbook_verbosity(self=self)
)
else:
@ -182,6 +195,9 @@ class IntrospectNode(command.Command):
node_uuids=parsed_args.node_uuids,
run_validations=parsed_args.run_validations,
concurrency=parsed_args.concurrency,
node_timeout=parsed_args.node_timeout,
max_retries=parsed_args.max_retries,
retry_timeout=parsed_args.retry_timeout,
verbosity=oooutils.playbook_verbosity(self=self)
)

View File

@ -158,7 +158,7 @@ def provide_manageable_nodes(clients, verbosity=0):
def introspect(clients, node_uuids, run_validations, concurrency,
verbosity=0):
node_timeout, max_retries, retry_timeout, verbosity=0):
"""Introspect Baremetal Nodes
:param clients: Application client object.
@ -188,6 +188,10 @@ def introspect(clients, node_uuids, run_validations, concurrency,
"node_uuids": node_uuids,
"run_validations": run_validations,
"concurrency": concurrency,
"node_timeout": node_timeout,
"max_retries": max_retries,
"retry_timeout": retry_timeout,
}
)
@ -195,17 +199,27 @@ def introspect(clients, node_uuids, run_validations, concurrency,
def introspect_manageable_nodes(clients, run_validations, concurrency,
node_timeout, max_retries, retry_timeout,
verbosity=0):
"""Introspect all manageable nodes
:param clients: Application client object.
:type clients: Object
:param verbosity: Enable or disable validations
:type verbosity: Boolean
:param run_validations: Enable or disable validations
:type run_validations: Boolean
:param verbosity: concurrency level
:type verbosity: Integer
:param concurrency: Concurrency level
:type concurrency: Integer
:param node_timeout: Node timeout for introspection
:type node_timeout: Integer
:param max_retries: Max retries for introspection
:type max_retries: Integer
:param retry_timeout: Max timeout to wait between retries
:type retry_timeout: Integer
:param verbosity: Verbosity level
:type verbosity: Integer
@ -219,6 +233,9 @@ def introspect_manageable_nodes(clients, run_validations, concurrency,
],
run_validations=run_validations,
concurrency=concurrency,
node_timeout=node_timeout,
max_retries=max_retries,
retry_timeout=retry_timeout,
verbosity=verbosity
)