Merge "Fix overcloud node provide"

This commit is contained in:
Zuul 2021-06-15 07:15:51 +00:00 committed by Gerrit Code Review
commit 7797524f71
4 changed files with 20 additions and 18 deletions

View File

@ -97,7 +97,7 @@ class TestBaremetalWorkflows(fakes.FakePlaybookExecution):
), [mock.ANY])
def test_provide_success(self):
baremetal.provide(self.app.client_manager, node_uuids=[])
baremetal.provide(node_uuids=[])
def test_introspect_success(self):
baremetal.introspect(self.app.client_manager, node_uuids=[],

View File

@ -218,10 +218,13 @@ class ProvideNode(command.Command):
self.log.debug("take_action(%s)" % parsed_args)
if parsed_args.node_uuids:
baremetal.provide(self.app.client_manager,
node_uuids=parsed_args.node_uuids)
baremetal.provide(node_uuids=parsed_args.node_uuids,
verbosity=oooutils.playbook_verbosity(self))
else:
baremetal.provide_manageable_nodes(self.app.client_manager)
baremetal.provide_manageable_nodes(
self.app.client_manager,
verbosity=oooutils.playbook_verbosity(self))
class CleanNode(command.Command):
@ -266,9 +269,8 @@ class CleanNode(command.Command):
if parsed_args.provide:
if nodes:
baremetal.provide(self.app.client_manager,
node_uuids=nodes,
)
baremetal.provide(node_uuids=nodes,
verbosity=oooutils.playbook_verbosity(self))
else:
baremetal.provide_manageable_nodes(self.app.client_manager)
@ -447,9 +449,9 @@ class DiscoverNode(command.Command):
)
if parsed_args.provide:
baremetal.provide(self.app.client_manager,
node_uuids=nodes_uuids
)
baremetal.provide(
node_uuids=nodes_uuids,
verbosity=oooutils.playbook_verbosity(self))
class ExtractProvisionedNode(command.Command):

View File

@ -207,8 +207,8 @@ class IntrospectNode(command.Command):
if parsed_args.provide:
if parsed_args.node_uuids:
baremetal.provide(
self.app.client_manager,
node_uuids=parsed_args.node_uuids,
verbosity=oooutils.playbook_verbosity(self=self)
)
else:
baremetal.provide_manageable_nodes(

View File

@ -102,15 +102,15 @@ def register_or_update(clients, nodes_json, kernel_name=None,
return registered_nodes
def provide(verbosity, node_uuids):
def provide(node_uuids, verbosity=0):
"""Provide Baremetal Nodes
:param verbosity: Verbosity level
:type verbosity: Integer
:param node_uuids: List of instance UUID(s).
:type node_uuids: List
"""
:param verbosity: Verbosity level
:type verbosity: Integer
"""
with utils.TempDirs() as tmp:
utils.run_ansible_playbook(
@ -138,11 +138,11 @@ def provide_manageable_nodes(clients, verbosity=0):
"""
provide(
verbosity=verbosity,
node_uuids=[
i.uuid for i in clients.baremetal.node.list()
if i.provision_state == "manageable" and not i.maintenance
]
],
verbosity=verbosity
)