Add an undeploy_roles workflow

This expands a list of instances with provisioned==False, then
unprovisions those instances. It will be run as the last step of a
scale-down or overcloud delete.

Change-Id: I9e9f1327070476326597c42ed14280a2088544bf
Blueprint: nova-less-deploy
This commit is contained in:
Steve Baker 2019-07-26 03:01:53 +00:00
parent ee98b993f1
commit 8d333d0d7d
2 changed files with 58 additions and 2 deletions

View File

@ -322,9 +322,12 @@ class UndeployInstanceAction(base.TripleOAction):
def run(self, context):
provisioner = _provisioner(context)
if isinstance(self.instance, dict):
inst = self.instance['hostname']
else:
inst = self.instance
try:
instance = provisioner.show_instance(self.instance)
instance = provisioner.show_instance(inst)
except Exception:
LOG.warning('Cannot get instance %s, assuming already deleted',
self.instance)

View File

@ -277,3 +277,56 @@ workflows:
instances: <% $.instances %>
new_instances: <% $.new_instances %>
port_map: <% $.port_map %>
undeploy_roles:
description: Undeploy provisioned=False instances in roles.
input:
- roles
- plan: overcloud
- timeout: 3600
- concurrency: 20
- queue_name: tripleo
tags:
- tripleo-common-managed
tasks:
expand_roles:
action: tripleo.baremetal_deploy.expand_roles
input:
roles: <% $.roles %>
stackname: <% $.plan %>
provisioned: False
publish:
input_instances: <% task().result.instances %>
publish-on-error:
status: FAILED
message: <% task().result %>
on-success: undeploy_instances
on-error: send_message
undeploy_instances:
workflow: tripleo.baremetal_deploy.v1.undeploy_instances
input:
instances: <% $.input_instances %>
timeout: <% $.timeout %>
queue_name: <% $.queue_name %>
publish-on-error:
status: FAILED
message: <% task().result %>
on-success: send_message
on-error: send_message
send_message:
workflow: tripleo.messaging.v1.send
input:
queue_name: <% $.queue_name %>
type: <% execution().name %>
status: <% $.get('status', 'SUCCESS') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
payload:
environment: <% $.get('environment', {}) %>
instances: <% $.get('instances', {}) %>