scale-down: run ansible_scale_down workflow before node_delete
With the new workflow, ansible_scale_down, we can now tear down the nodes before they get deleted from the stack. blueprint scale-down-tasks Change-Id: I9982f3854604497c804d7875b926f14e1060b788
This commit is contained in:
parent
4460b91b0f
commit
25d98a6809
|
@ -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', ],
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue