Add support for calling validations from introspection
The 'bulk introspection start' and 'overcloud node introspect' commands can now enable the usage of the additional validations that are called via workflows. Commands now accept a '--run-validations' switch. Change-Id: Ifcb30b9ceb15d82fffcda24cb98f2d03f4ded354 Partial-Bug: #1638697 Depends-On: I439361ae20c4e302b83870cdc06a5baa90ea683c
This commit is contained in:
parent
7e587d8932
commit
553e46e76a
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
features:
|
||||
- Adds the ability for external TripleO validations to
|
||||
be called during an introspection workflow.
|
|
@ -606,7 +606,10 @@ class TestStartBaremetalIntrospectionBulk(fakes.TestBaremetal):
|
|||
|
||||
call_list = [mock.call(
|
||||
'tripleo.baremetal.v1.introspect_manageable_nodes',
|
||||
workflow_input={'queue_name': 'UUID4'}
|
||||
workflow_input={
|
||||
'run_validations': False,
|
||||
'queue_name': 'UUID4'
|
||||
}
|
||||
)]
|
||||
|
||||
if provide:
|
||||
|
|
|
@ -262,7 +262,10 @@ class TestIntrospectNode(fakes.TestOvercloudNode):
|
|||
|
||||
call_list = [mock.call(
|
||||
'tripleo.baremetal.v1.introspect_manageable_nodes',
|
||||
workflow_input={'queue_name': 'UUID4'}
|
||||
workflow_input={
|
||||
'run_validations': False,
|
||||
'queue_name': 'UUID4'
|
||||
}
|
||||
)]
|
||||
|
||||
if provide:
|
||||
|
@ -287,6 +290,7 @@ class TestIntrospectNode(fakes.TestOvercloudNode):
|
|||
call_list = [mock.call(
|
||||
'tripleo.baremetal.v1.introspect', workflow_input={
|
||||
'node_uuids': nodes,
|
||||
'run_validations': False,
|
||||
'queue_name': 'UUID4'}
|
||||
)]
|
||||
|
||||
|
@ -412,6 +416,7 @@ class TestImportNode(fakes.TestOvercloudNode):
|
|||
call_list.append(mock.call(
|
||||
'tripleo.baremetal.v1.introspect', workflow_input={
|
||||
'node_uuids': ['MOCK_NODE_UUID'],
|
||||
'run_validations': False,
|
||||
'queue_name': 'UUID4'}
|
||||
))
|
||||
|
||||
|
|
|
@ -149,12 +149,13 @@ class TestBaremetalWorkflows(utils.TestCommand):
|
|||
}
|
||||
|
||||
baremetal.introspect(self.app.client_manager, node_uuids=[],
|
||||
queue_name="QUEUE_NAME")
|
||||
run_validations=True, queue_name="QUEUE_NAME")
|
||||
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
'tripleo.baremetal.v1.introspect',
|
||||
workflow_input={
|
||||
'node_uuids': [],
|
||||
'run_validations': True,
|
||||
'queue_name': "QUEUE_NAME"
|
||||
})
|
||||
|
||||
|
@ -171,12 +172,14 @@ class TestBaremetalWorkflows(utils.TestCommand):
|
|||
baremetal.introspect,
|
||||
self.app.client_manager,
|
||||
node_uuids=[],
|
||||
run_validations=False,
|
||||
queue_name="QUEUE_NAME")
|
||||
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
'tripleo.baremetal.v1.introspect',
|
||||
workflow_input={
|
||||
'node_uuids': [],
|
||||
'run_validations': False,
|
||||
'queue_name': "QUEUE_NAME"
|
||||
})
|
||||
|
||||
|
@ -188,11 +191,15 @@ class TestBaremetalWorkflows(utils.TestCommand):
|
|||
}
|
||||
|
||||
baremetal.introspect_manageable_nodes(
|
||||
self.app.client_manager, queue_name="QUEUE_NAME")
|
||||
self.app.client_manager, run_validations=False,
|
||||
queue_name="QUEUE_NAME")
|
||||
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
'tripleo.baremetal.v1.introspect_manageable_nodes',
|
||||
workflow_input={'queue_name': "QUEUE_NAME"})
|
||||
workflow_input={
|
||||
'run_validations': False,
|
||||
'queue_name': "QUEUE_NAME"
|
||||
})
|
||||
|
||||
def test_introspect_manageable_nodes_error(self):
|
||||
|
||||
|
@ -204,11 +211,16 @@ class TestBaremetalWorkflows(utils.TestCommand):
|
|||
self.assertRaises(
|
||||
exceptions.IntrospectionError,
|
||||
baremetal.introspect_manageable_nodes,
|
||||
self.app.client_manager, queue_name="QUEUE_NAME")
|
||||
self.app.client_manager,
|
||||
run_validations=False,
|
||||
queue_name="QUEUE_NAME")
|
||||
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
'tripleo.baremetal.v1.introspect_manageable_nodes',
|
||||
workflow_input={'queue_name': "QUEUE_NAME"})
|
||||
workflow_input={
|
||||
'run_validations': False,
|
||||
'queue_name': "QUEUE_NAME"
|
||||
})
|
||||
|
||||
def test_introspect_manageable_nodes_mixed_status(self):
|
||||
|
||||
|
@ -221,11 +233,16 @@ class TestBaremetalWorkflows(utils.TestCommand):
|
|||
self.assertRaises(
|
||||
exceptions.IntrospectionError,
|
||||
baremetal.introspect_manageable_nodes,
|
||||
self.app.client_manager, queue_name="QUEUE_NAME")
|
||||
self.app.client_manager,
|
||||
run_validations=False,
|
||||
queue_name="QUEUE_NAME")
|
||||
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
'tripleo.baremetal.v1.introspect_manageable_nodes',
|
||||
workflow_input={'queue_name': "QUEUE_NAME"})
|
||||
workflow_input={
|
||||
'run_validations': False,
|
||||
'queue_name': "QUEUE_NAME"
|
||||
})
|
||||
|
||||
def test_provide_manageable_nodes_success(self):
|
||||
|
||||
|
|
|
@ -206,6 +206,16 @@ class StartBaremetalIntrospectionBulk(command.Command):
|
|||
|
||||
log = logging.getLogger(__name__ + ".StartBaremetalIntrospectionBulk")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(StartBaremetalIntrospectionBulk, self).get_parser(
|
||||
prog_name)
|
||||
parser.add_argument('--run-validations', action='store_true',
|
||||
default=False,
|
||||
help=_('Run the pre-deployment validations. These '
|
||||
'external validations are from the TripleO '
|
||||
'Validations project.'))
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
|
@ -229,7 +239,10 @@ class StartBaremetalIntrospectionBulk(command.Command):
|
|||
"Node {0} has been set to manageable.".format(node_uuid))
|
||||
|
||||
print("Starting introspection of manageable nodes")
|
||||
baremetal.introspect_manageable_nodes(clients, queue_name=queue_name)
|
||||
baremetal.introspect_manageable_nodes(
|
||||
clients,
|
||||
run_validations=parsed_args.run_validations,
|
||||
queue_name=queue_name)
|
||||
|
||||
print("Setting manageable nodes to available...")
|
||||
self.log.debug("Moving manageable nodes to available state.")
|
||||
|
|
|
@ -137,6 +137,11 @@ class IntrospectNode(command.Command):
|
|||
action='store_true',
|
||||
help=_('Provide (make available) the nodes once '
|
||||
'introspected'))
|
||||
parser.add_argument('--run-validations', action='store_true',
|
||||
default=False,
|
||||
help=_('Run the pre-deployment validations. These '
|
||||
'external validations are from the TripleO '
|
||||
'Validations project.'))
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
|
@ -148,10 +153,13 @@ class IntrospectNode(command.Command):
|
|||
if nodes:
|
||||
baremetal.introspect(self.app.client_manager,
|
||||
node_uuids=nodes,
|
||||
run_validations=parsed_args.run_validations,
|
||||
queue_name=queue_name)
|
||||
else:
|
||||
baremetal.introspect_manageable_nodes(self.app.client_manager,
|
||||
queue_name=queue_name)
|
||||
baremetal.introspect_manageable_nodes(
|
||||
self.app.client_manager,
|
||||
run_validations=parsed_args.run_validations,
|
||||
queue_name=queue_name)
|
||||
|
||||
if parsed_args.provide:
|
||||
if nodes:
|
||||
|
@ -176,6 +184,11 @@ class ImportNode(command.Command):
|
|||
parser.add_argument('--introspect',
|
||||
action='store_true',
|
||||
help=_('Introspect the imported nodes'))
|
||||
parser.add_argument('--run-validations', action='store_true',
|
||||
default=False,
|
||||
help=_('Run the pre-deployment validations. These '
|
||||
'external validations are from the TripleO '
|
||||
'Validations project.'))
|
||||
parser.add_argument('--provide',
|
||||
action='store_true',
|
||||
help=_('Provide (make available) the nodes'))
|
||||
|
@ -218,6 +231,7 @@ class ImportNode(command.Command):
|
|||
if parsed_args.introspect:
|
||||
baremetal.introspect(self.app.client_manager,
|
||||
node_uuids=nodes_uuids,
|
||||
run_validations=parsed_args.run_validations,
|
||||
queue_name=queue_name)
|
||||
|
||||
if parsed_args.provide:
|
||||
|
|
|
@ -107,6 +107,7 @@ def introspect(clients, **workflow_input):
|
|||
workflow_client,
|
||||
'tripleo.baremetal.v1.introspect',
|
||||
workflow_input={'node_uuids': workflow_input['node_uuids'],
|
||||
'run_validations': workflow_input['run_validations'],
|
||||
'queue_name': queue_name}
|
||||
)
|
||||
|
||||
|
@ -138,7 +139,8 @@ def introspect_manageable_nodes(clients, **workflow_input):
|
|||
execution = base.start_workflow(
|
||||
workflow_client,
|
||||
'tripleo.baremetal.v1.introspect_manageable_nodes',
|
||||
workflow_input={"queue_name": queue_name, }
|
||||
workflow_input={'run_validations': workflow_input['run_validations'],
|
||||
"queue_name": queue_name, }
|
||||
)
|
||||
|
||||
print("Waiting for introspection to finish...")
|
||||
|
|
Loading…
Reference in New Issue