From 0bd4cfc1972b34796ddcd920c543901e2e854d06 Mon Sep 17 00:00:00 2001 From: Steven Hardy Date: Thu, 2 Feb 2017 18:29:52 +0000 Subject: Disable batch upgrade deployments for disabled roles Currently we don't correctly disable the batch_upgrade_tasks, so rework the loops to ensure we only create the batch deployments for roles which enabled upgrades. Note this modifies some loop whitespace too which cleans up the rendered output and makes it a bit more readable/compact. Change-Id: I1c257dcc351e99efa54f9cae4b3009287908756e Partially-Renders: blueprint overcloud-upgrades-per-service --- puppet/major_upgrade_steps.j2.yaml | 87 +++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 43 deletions(-) (limited to 'puppet/major_upgrade_steps.j2.yaml') diff --git a/puppet/major_upgrade_steps.j2.yaml b/puppet/major_upgrade_steps.j2.yaml index 88732f49..b879fafa 100644 --- a/puppet/major_upgrade_steps.j2.yaml +++ b/puppet/major_upgrade_steps.j2.yaml @@ -36,34 +36,37 @@ conditions: resources: # Upgrade Steps for all roles, batched updates +# The UpgradeConfig resources could actually be created without +# serialization, but the event output is easier to follow if we +# do, and there should be minimal performance hit (creating the +# config is cheap compared to the time to apply the deployment). {% for step in range(0, batch_upgrade_steps_max) %} - {% for role in roles %} - # Step {{step}} resources + # Batch config resources step {{step}} + {%- for role in roles %} {{role.name}}UpgradeBatchConfig_Step{{step}}: type: OS::TripleO::UpgradeConfig - # The UpgradeConfig resources could actually be created without - # serialization, but the event output is easier to follow if we - # do, and there should be minimal performance hit (creating the - # config is cheap compared to the time to apply the deployment). - {% if step > 0 %} + {%- if step > 0 %} depends_on: - {% for dep in roles %} + {%- for dep in enabled_roles %} - {{dep.name}}UpgradeBatch_Step{{step -1}} - {% endfor %} - {% endif %} + {%- endfor %} + {%- endif %} properties: UpgradeStepConfig: {get_param: [role_data, {{role.name}}, upgrade_batch_tasks]} step: {{step}} + {%- endfor %} + # Batch deployment resources for step {{step}} (only for enabled roles) + {%- for role in enabled_roles %} {{role.name}}UpgradeBatch_Step{{step}}: - type: OS::Heat::StructuredDeploymentGroup + type: OS::Heat::SoftwareDeploymentGroup condition: {{role.name}}UpgradeBatchConfigEnabled - {% if step > 0 %} + {%- if step > 0 %} depends_on: - {% for dep in roles %} + {%- for dep in enabled_roles %} - {{dep.name}}UpgradeBatch_Step{{step -1}} - {% endfor %} - {% endif %} + {%- endfor %} + {%- endif %} update_policy: batch_create: max_batch_size: {{role.upgrade_batch_size|default(1)}} @@ -76,13 +79,13 @@ resources: input_values: role: {{role.name}} update_identifier: {get_param: UpdateIdentifier} - {% endfor %} -{% endfor %} + {%- endfor %} +{%- endfor %} # Upgrade Steps for all roles -{% for step in range(0, upgrade_steps_max) %} - {% for role in roles %} - # Step {{step}} resources +{%- for step in range(0, upgrade_steps_max) %} + # Config resources for step {{step}} + {%- for role in roles %} {{role.name}}UpgradeConfig_Step{{step}}: type: OS::TripleO::UpgradeConfig # The UpgradeConfig resources could actually be created without @@ -90,36 +93,35 @@ resources: # do, and there should be minimal performance hit (creating the # config is cheap compared to the time to apply the deployment). depends_on: - {% if step > 0 %} - {% for dep in roles %} - {% if not dep.disable_upgrade_deployment|default(false) %} + {%- if step > 0 %} + {%- for dep in enabled_roles %} - {{dep.name}}Upgrade_Step{{step -1}} - {% endif %} - {% endfor %} - {% else %} - {% for dep in roles %} + {%- endfor %} + {%- else %} + {%- for dep in enabled_roles %} - {{dep.name}}UpgradeBatch_Step{{batch_upgrade_steps_max -1}} - {% endfor %} - {% endif %} + {%- endfor %} + {%- endif %} properties: UpgradeStepConfig: {get_param: [role_data, {{role.name}}, upgrade_tasks]} step: {{step}} - {% if not role.disable_upgrade_deployment|default(false) %} + {%- endfor %} + + # Deployment resources for step {{step}} (only for enabled roles) + {%- for role in enabled_roles %} {{role.name}}Upgrade_Step{{step}}: - type: OS::Heat::StructuredDeploymentGroup + type: OS::Heat::SoftwareDeploymentGroup condition: {{role.name}}UpgradeConfigEnabled depends_on: - {% if step > 0 %} - {% for dep in roles %} - {% if not dep.disable_upgrade_deployment|default(false) %} + {%- if step > 0 %} + {%- for dep in enabled_roles %} - {{dep.name}}Upgrade_Step{{step -1}} - {% endif %} - {% endfor %} - {% else %} - {% for dep in roles %} + {%- endfor %} + {%- else %} + {%- for dep in enabled_roles %} - {{dep.name}}UpgradeBatch_Step{{batch_upgrade_steps_max -1}} - {% endfor %} - {% endif %} + {%- endfor %} + {%- endif %} properties: name: {{role.name}}Upgrade_Step{{step}} servers: {get_param: [servers, {{role.name}}]} @@ -127,9 +129,8 @@ resources: input_values: role: {{role.name}} update_identifier: {get_param: UpdateIdentifier} - {% endif %} - {% endfor %} -{% endfor %} + {%- endfor %} +{%- endfor %} # Post upgrade deployment steps for all roles # This runs the normal configuration (e.g puppet) steps unless upgrade -- cgit 1.2.3-korg