Merge "scale-down: run ansible_scale_down workflow before node_delete"

This commit is contained in:
Zuul 2019-05-02 10:30:58 +00:00 committed by Gerrit Code Review
commit d6ca90eb3e
2 changed files with 26 additions and 5 deletions

View File

@ -73,7 +73,7 @@ class TestDeleteNode(fakes.TestDeleteNode):
self.cmd.take_action(parsed_args)
# Verify
self.workflow.executions.create.assert_called_once_with(
self.workflow.executions.create.assert_called_with(
'tripleo.scale.v1.delete_node',
workflow_input={
'container': 'overcast',
@ -117,7 +117,7 @@ class TestDeleteNode(fakes.TestDeleteNode):
self.cmd.take_action(parsed_args)
# Verify
self.workflow.executions.create.assert_called_once_with(
self.workflow.executions.create.assert_called_with(
'tripleo.scale.v1.delete_node',
workflow_input={
'container': 'overcloud',
@ -146,8 +146,8 @@ class TestDeleteNode(fakes.TestDeleteNode):
self.cmd.take_action, parsed_args)
# Verify
self.workflow.executions.create.assert_called_once_with(
'tripleo.scale.v1.delete_node',
self.workflow.executions.create.assert_called_with(
'tripleo.scale.v1.ansible_scale_down',
workflow_input={
'container': 'overcloud',
'nodes': ['wrong_instance', ],

View File

@ -18,6 +18,26 @@ from tripleoclient.exceptions import InvalidConfiguration
from tripleoclient.workflows import base
def ansible_tear_down(clients, **workflow_input):
workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient
with tripleoclients.messaging_websocket() as ws:
execution = base.start_workflow(
workflow_client,
'tripleo.scale.v1.ansible_scale_down',
workflow_input=workflow_input
)
for payload in base.wait_for_messages(workflow_client, ws, execution):
status = payload['status']
if status == 'RUNNING':
continue
if status != 'SUCCESS':
raise InvalidConfiguration(payload['message'])
def delete_node(clients, **workflow_input):
workflow_client = clients.workflow_engine
@ -39,7 +59,7 @@ def delete_node(clients, **workflow_input):
def scale_down(clients, plan_name, nodes, timeout=None):
"""Deletes overcloud nodes from a heat stack.
"""Unprovision and deletes overcloud nodes from a heat stack.
:param clients: openstack clients
:param plan_name: name of the container holding the plan data
@ -55,4 +75,5 @@ def scale_down(clients, plan_name, nodes, timeout=None):
if timeout is not None:
workflow_input['timeout'] = timeout
ansible_tear_down(clients, **workflow_input)
delete_node(clients, **workflow_input)