ffu: Add fast-forward upgrade outputs to RoleConfig

As outlined in the spec, fast-forward upgrades aim to take an
environment from an initial release of N to a release of N>=2, beyond
that of the traditionally supported N+1 upgrade path provided today by
many OpenStack projects.

For TripleO the first phase of this upgrade will be to move the
environment to the release prior to the target release. This will be
achieved by disabling all OpenStack control plane services and then
preforming the minimum number of steps required to upgrade each service
through each release until finally reaching the target release.

This change introduces the framework for this phase of the fast-forward
upgrades by adding playbooks and task files as outputs to RoleConfig.

- fast_forward_upgrade_playbook.yaml

This is the top level play and acts as the outer loop of the process,
iterating through the required releases as set by the
FastForwardUpgradeReleases parameter for the fast-forward section of the
upgrade. This currently defaults to Ocata and Pike for Queens.

Note that this play is run against the overcloud host group and it is
currently assumed that the inventory used to run this play is provided
by the tripleo-ansible-inventory command.

- fast_forward_upgrade_release_tasks.yaml

This output simply imports the top level prep and bootstrap task files.

- fast_forward_upgrade_prep_tasks.yaml
- fast_forward_upgrade_bootstrap_tasks.yaml

These outputs act as the inner loop for the fast-forward upgrade phase,
iterating over step values while importing their associated role tasks.

As prep tasks are carried out first for each release we loop over step
values starting at 0 and ending at the defined
fast_forward_upgrade_prep_steps_max, currently 3.

Following this we then complete the bootstrap tasks for each release,
looping over steps values starting at
fast_forward_upgrade_prep_steps_max + 1 , currently 4 and ending at
fast_forward_upgrade_steps_max,currently 9.

- fast_forward_upgrade_prep_role_tasks.yaml
- fast_forward_upgrade_bootstrap_role_tasks.yaml

These outputs then finally import the fast_forward_upgrade_tasks files
generated by the FastForwardUpgradeTasks YAQL query for each role. For
prep tasks these are always included when on an Ansible host of a given
role. This differs from bootstrap tasks that are only included for the
first host associated with a given role.

This will result in the following order of task imports with their
associated value of release and step:

fast_forward_upgrade_playbook
\_fast_forward_upgrade_release_tasks
  \_fast_forward_upgrade_prep_tasks              - release=ocata
     \_fast_forward_upgrade_prep_role_tasks      - release=ocata
       \_$roleA/fast_forward_upgrade_tasks       - release=ocata, step=0
       \_$roleB/fast_forward_upgrade_tasks       - release=ocata, step=0
       \_$roleA/fast_forward_upgrade_tasks       - release=ocata, step=1
       \_$roleB/fast_forward_upgrade_tasks       - release=ocata, step=1
       \_$roleA/fast_forward_upgrade_tasks       - release=ocata, step=2
       \_$roleB/fast_forward_upgrade_tasks       - release=ocata, step=2
       \_$roleA/fast_forward_upgrade_tasks       - release=ocata, step=3
       \_$roleB/fast_forward_upgrade_tasks       - release=ocata, step=3
  \_fast_forward_upgrade_bootstrap_tasks         - release=ocata
     \_fast_forward_upgrade_bootstrap_role_tasks - release=ocata
       \_$roleA/fast_forward_upgrade_tasks       - release=ocata, step=4
       \_$roleB/fast_forward_upgrade_tasks       - release=ocata, step=4
       \_$roleA/fast_forward_upgrade_tasks       - release=ocata, step=5
       \_$roleB/fast_forward_upgrade_tasks       - release=ocata, step=5
       \_$roleA/fast_forward_upgrade_tasks       - release=ocata, step=N
       \_$roleB/fast_forward_upgrade_tasks       - release=ocata, step=N
\_fast_forward_upgrade_release_tasks
  \_fast_forward_upgrade_prep_tasks              - release=pike
     \_fast_forward_upgrade_prep_role_tasks      - release=pike
       \_$roleA/fast_forward_upgrade_tasks       - release=pike, step=0
       \_$roleB/fast_forward_upgrade_tasks       - release=pike, step=0
       \_$roleA/fast_forward_upgrade_tasks       - release=pike, step=1
       \_$roleB/fast_forward_upgrade_tasks       - release=pike, step=1
       \_$roleA/fast_forward_upgrade_tasks       - release=pike, step=2
       \_$roleB/fast_forward_upgrade_tasks       - release=pike, step=2
       \_$roleA/fast_forward_upgrade_tasks       - release=pike, step=3
       \_$roleB/fast_forward_upgrade_tasks       - release=pike, step=3
   \_fast_forward_upgrade_bootstrap_tasks        - release=pike
     \_fast_forward_upgrade_bootstrap_role_tasks - release=pike
       \_$roleA/fast_forward_upgrade_tasks       - release=pike, step=4
       \_$roleB/fast_forward_upgrade_tasks       - release=pike, step=4
       \_$roleA/fast_forward_upgrade_tasks       - release=pike, step=5
       \_$roleB/fast_forward_upgrade_tasks       - release=pike, step=5
       \_$roleA/fast_forward_upgrade_tasks       - release=pike, step=N
       \_$roleB/fast_forward_upgrade_tasks       - release=pike, step=N

bp fast-forward-upgrades
Change-Id: Ie2683fd7b81167abe724a7b9245bf85a0a87ad1d
This commit is contained in:
Lee Yarwood 2017-08-25 14:25:08 +01:00 committed by Lukas Bezdicka
parent 0cb5c847f3
commit acb2475e4c
4 changed files with 84 additions and 0 deletions

View File

@ -21,6 +21,8 @@
{% set update_steps_max = 6 -%}
{% set upgrade_steps_max = 6 -%}
{% set post_upgrade_steps_max = 4 -%}
{% set fast_forward_upgrade_steps_max = 9 -%}
{% set fast_forward_upgrade_prep_steps_max = 3 -%}
heat_template_version: queens
@ -71,6 +73,10 @@ parameters:
description: List of hostnames belong to blacklisted servers
type: comma_delimited_list
default: []
FastForwardUpgradeReleases:
type: comma_delimited_list
default: ['ocata', 'pike']
description: List of releases to fast forward through during upgrade.
conditions:
{% for step in range(1, deploy_steps_max) %}
@ -553,3 +559,34 @@ outputs:
with_sequence: start=0 end={{post_upgrade_steps_max-1}}
loop_control:
loop_var: step
fast_forward_upgrade_playbook:
- hosts: overcloud
become: true
tasks:
- include_tasks: fast_forward_upgrade_release_tasks.yaml
loop_control:
loop_var: release
with_items: {get_param: [FastForwardUpgradeReleases]}
fast_forward_upgrade_release_tasks: |
- include_tasks: fast_forward_upgrade_prep_tasks.yaml
- include_tasks: fast_forward_upgrade_bootstrap_tasks.yaml
fast_forward_upgrade_prep_tasks: |
- include_tasks: fast_forward_upgrade_prep_role_tasks.yaml
with_sequence: start=0 end={{fast_forward_upgrade_prep_steps_max}}
loop_control:
loop_var: step
fast_forward_upgrade_prep_role_tasks: |
{%- for role in roles %}
- include_tasks: {{role.name}}/fast_forward_upgrade_tasks.yaml
when: role_name == '{{role.name}}'
{%- endfor %}
fast_forward_upgrade_bootstrap_tasks: |
- include_tasks: fast_forward_upgrade_bootstrap_role_tasks.yaml
with_sequence: start={{fast_forward_upgrade_prep_steps_max+1}} end={{fast_forward_upgrade_steps_max}}
loop_control:
loop_var: step
fast_forward_upgrade_bootstrap_role_tasks: |
{%- for role in roles %}
- include_tasks: {{role.name}}/fast_forward_upgrade_tasks.yaml
when: role_name == '{{role.name}}' and ansible_hostname == {{role.name}}[0]
{%- endfor %}

View File

@ -244,6 +244,15 @@ resources:
expression: coalesce($.data, []).where($ != null).select($.get('external_post_deploy_tasks')).where($ != null).flatten().distinct()
data: {get_attr: [ServiceChain, role_data]}
FastForwardUpgradeTasks:
type: OS::Heat::Value
properties:
type: comma_delimited_list
value:
yaql:
expression: coalesce($.data, []).where($ != null).select($.get('fast_forward_upgrade_tasks')).where($ != null).flatten().distinct()
data: {get_attr: [ServiceChain, role_data]}
UpgradeTasks:
type: OS::Heat::Value
properties:
@ -336,6 +345,7 @@ outputs:
deploy_steps_tasks: {get_attr: [DeployStepsTasks, value]}
external_deploy_tasks: {get_attr: [ExternalDeployTasks, value]}
external_post_deploy_tasks: {get_attr: [ExternalPostDeployTasks, value]}
fast_forward_upgrade_tasks: {get_attr: [FastForwardUpgradeTasks, value]}
upgrade_tasks: {get_attr: [UpgradeTasks, value]}
post_upgrade_tasks: {get_attr: [PostUpgradeTasks, value]}
update_tasks: {get_attr: [UpdateTasks, value]}

View File

@ -140,3 +140,32 @@ all containerized services and the updated configuration if any.
Note: as pacemaker is not containerized, the points 1 and 4 happen in
puppet/services/pacemaker.yaml.
Fast-forward Upgrade Steps
--------------------------
Each service template may optionally define a `fast_forward_upgrade_tasks` key,
which is a list of Ansible tasks to be performed during the fast-forward
upgrade process. As with Upgrade steps each task is associated to a particular
step provided as a variable and used along with a release variable by a basic
conditional that determines when the task should run.
Steps are broken down into two categories, prep tasks executed across all hosts
and bootstrap tasks executed on a single host for a given role.
The individual steps then correspond to the following tasks during the upgrade:
Prep steps:
- Step=1: Stop the cluster
- Step=2: Stop the service
- Step=3: Update repos
Bootstrap steps:
- Step=4: DB backups
- Step=5: Pre package update commands
- Step=6: Package updates
- Step=7: Post package update commands
- Step=8: DB syncs
- Step=9: Verification

View File

@ -0,0 +1,8 @@
---
upgrade:
- |
Each service template may optionally define a `fast_forward_upgrade_tasks`
key, which is a list of ansible tasks to be performed during the
fast-forward upgrade process. As with Upgrade steps each task is associated
to a particular step provided as a variable and used along with a release
variable by a basic conditional that determines when the task should run.