Skip upgrade steps where no tasks are defined

Use heat conditions to skip resources (conditionally create them)
when there are no tasks to deploy.

This requires the heat fix Iefae1fcea720bee4ed69ad1a5fe403d52d54433c

Partially-Implements: blueprint overcloud-upgrades-per-service
Change-Id: I2f43fb922d122ffade20e35738f0ba3bb56a4492
This commit is contained in:
Steven Hardy 2017-01-20 16:51:36 +00:00
parent 9f908e9832
commit 5e575fbb57

View File

@ -16,6 +16,23 @@ parameters:
Setting to a previously unused value during stack-update will trigger Setting to a previously unused value during stack-update will trigger
the Upgrade resources to re-run on all roles. the Upgrade resources to re-run on all roles.
conditions:
# Conditions to disable any steps where the task list is empty
{% for step in range(0, upgrade_steps_max) %}
{% for role in roles %}
UpgradeBatchConfig_Step{{step}}Enabled:
not:
equals:
- {get_param: [role_data, {{role.name}}, upgrade_batch_tasks]}
- []
UpgradeConfig_Step{{step}}Enabled:
not:
equals:
- {get_param: [role_data, {{role.name}}, upgrade_tasks]}
- []
{% endfor %}
{% endfor %}
resources: resources:
# Upgrade Steps for all roles, batched updates # Upgrade Steps for all roles, batched updates
@ -25,6 +42,7 @@ resources:
# Step {{step}} resources # Step {{step}} resources
{{role.name}}UpgradeBatchConfig_Step{{step}}: {{role.name}}UpgradeBatchConfig_Step{{step}}:
type: OS::TripleO::UpgradeConfig type: OS::TripleO::UpgradeConfig
condition: UpgradeBatchConfig_Step{{step}}Enabled
# The UpgradeConfig resources could actually be created without # The UpgradeConfig resources could actually be created without
# serialization, but the event output is easier to follow if we # serialization, but the event output is easier to follow if we
# do, and there should be minimal performance hit (creating the # do, and there should be minimal performance hit (creating the
@ -41,6 +59,7 @@ resources:
{{role.name}}UpgradeBatch_Step{{step}}: {{role.name}}UpgradeBatch_Step{{step}}:
type: OS::Heat::StructuredDeploymentGroup type: OS::Heat::StructuredDeploymentGroup
condition: UpgradeBatchConfig_Step{{step}}Enabled
{% if step > 0 %} {% if step > 0 %}
depends_on: depends_on:
{% for dep in roles %} {% for dep in roles %}
@ -69,6 +88,7 @@ resources:
# Step {{step}} resources # Step {{step}} resources
{{role.name}}UpgradeConfig_Step{{step}}: {{role.name}}UpgradeConfig_Step{{step}}:
type: OS::TripleO::UpgradeConfig type: OS::TripleO::UpgradeConfig
condition: UpgradeConfig_Step{{step}}Enabled
# The UpgradeConfig resources could actually be created without # The UpgradeConfig resources could actually be created without
# serialization, but the event output is easier to follow if we # serialization, but the event output is easier to follow if we
# do, and there should be minimal performance hit (creating the # do, and there should be minimal performance hit (creating the
@ -91,6 +111,7 @@ resources:
{% if not role.disable_upgrade_deployment|default(false) %} {% if not role.disable_upgrade_deployment|default(false) %}
{{role.name}}Upgrade_Step{{step}}: {{role.name}}Upgrade_Step{{step}}:
type: OS::Heat::StructuredDeploymentGroup type: OS::Heat::StructuredDeploymentGroup
condition: UpgradeConfig_Step{{step}}Enabled
depends_on: depends_on:
{% if step > 0 %} {% if step > 0 %}
{% for dep in roles %} {% for dep in roles %}