From ae085825e22cb4ce7bf877087c2e324b8bec1f03 Mon Sep 17 00:00:00 2001 From: Jiri Stransky Date: Mon, 12 Mar 2018 17:02:36 +0100 Subject: [PATCH] Add pre_upgrade_rolling_tasks The resultin pre_upgrade_rolling_steps_playbook will be executed in a node-by-node rolling fashion at the beginning of major upgrade workflow (before upgrade_steps_playbook). The current intended use case is special handling of L3 agent upgrade when moving Neutron services into containers. Special care needs to be taken in this case to preserve L3 connectivity of instances (with regard to dnsmasq and keepalived sub-processes of L3 agent). The playbook can be run before the main upgrade like this: openstack overcloud upgrade run --roles overcloud --playbook pre_upgrade_rolling_steps_playbook.yaml Partial-Bug: #1738768 Change-Id: Icb830f8500bb80fd15036e88fcd314bf2c54445d Implements: blueprint major-upgrade-workflow --- common/deploy-steps.j2 | 28 +++++++++++++++++++ common/services.yaml | 10 +++++++ ...pgrade_rolling_tasks-6345e98e8283a907.yaml | 9 ++++++ tools/yaml-validate.py | 1 + 4 files changed, 48 insertions(+) create mode 100644 releasenotes/notes/pre_upgrade_rolling_tasks-6345e98e8283a907.yaml diff --git a/common/deploy-steps.j2 b/common/deploy-steps.j2 index f0edd29af6..832795a932 100644 --- a/common/deploy-steps.j2 +++ b/common/deploy-steps.j2 @@ -19,6 +19,7 @@ # primary role is: {{primary_role_name}} {% set deploy_steps_max = 6 -%} {% set update_steps_max = 6 -%} +{% set pre_upgrade_rolling_steps_max = 1 -%} {% set upgrade_steps_max = 6 -%} {% set post_upgrade_steps_max = 4 -%} {% set fast_forward_upgrade_steps_max = 9 -%} @@ -537,6 +538,33 @@ outputs: with_sequence: start=1 end={{deploy_steps_max-1}} loop_control: loop_var: step + pre_upgrade_rolling_steps_tasks: | +{%- for role in roles %} + - include: {{role.name}}/pre_upgrade_rolling_tasks.yaml + when: role_name == '{{role.name}}' +{%- endfor %} + pre_upgrade_rolling_steps_playbook: | + - hosts: undercloud + name: Gather facts undercloud + gather_facts: yes + become: false + - hosts: overcloud + name: Gather facts overcloud + gather_facts: yes + - hosts: all + name: Load global variables + gather_facts: no + tasks: + - include_vars: global_vars.yaml + - hosts: overcloud + name: Run pre-upgrade rolling tasks + serial: 1 + gather_facts: no + tasks: + - include: pre_upgrade_rolling_steps_tasks.yaml + with_sequence: start=0 end={{pre_upgrade_rolling_steps_max-1}} + loop_control: + loop_var: step upgrade_steps_tasks: | {%- for role in roles %} - include: {{role.name}}/upgrade_tasks.yaml diff --git a/common/services.yaml b/common/services.yaml index 97e22ee5ac..2bfab14cc6 100644 --- a/common/services.yaml +++ b/common/services.yaml @@ -262,6 +262,15 @@ resources: expression: coalesce($.data, []).where($ != null).select($.get('fast_forward_post_upgrade_tasks')).where($ != null).flatten().distinct() data: {get_attr: [ServiceChain, role_data]} + PreUpgradeRollingTasks: + type: OS::Heat::Value + properties: + type: comma_delimited_list + value: + yaql: + expression: coalesce($.data, []).where($ != null).select($.get('pre_upgrade_rolling_tasks')).where($ != null).flatten().distinct() + data: {get_attr: [ServiceChain, role_data]} + UpgradeTasks: type: OS::Heat::Value properties: @@ -366,6 +375,7 @@ outputs: external_post_deploy_tasks: {get_attr: [ExternalPostDeployTasks, value]} fast_forward_upgrade_tasks: {get_attr: [FastForwardUpgradeTasks, value]} fast_forward_post_upgrade_tasks: {get_attr: [FastForwardPostUpgradeTasks, value]} + pre_upgrade_rolling_tasks: {get_attr: [PreUpgradeRollingTasks, value]} upgrade_tasks: {get_attr: [UpgradeTasks, value]} post_upgrade_tasks: {get_attr: [PostUpgradeTasks, value]} update_tasks: {get_attr: [UpdateTasks, value]} diff --git a/releasenotes/notes/pre_upgrade_rolling_tasks-6345e98e8283a907.yaml b/releasenotes/notes/pre_upgrade_rolling_tasks-6345e98e8283a907.yaml new file mode 100644 index 0000000000..de9387c46a --- /dev/null +++ b/releasenotes/notes/pre_upgrade_rolling_tasks-6345e98e8283a907.yaml @@ -0,0 +1,9 @@ +--- +upgrade: + - | + pre_upgrade_rolling_tasks are added for use by the composable + service templates. The resulting + pre_upgrade_rolling_steps_playbook is intended to be run at the + beginning of major update workflow (before running the + upgrade_steps_playbook). As the name suggests, the tasks in this + playbook will be executed in a node-by-node rolling fashion. diff --git a/tools/yaml-validate.py b/tools/yaml-validate.py index d7d0d87af2..9c83e0bc74 100755 --- a/tools/yaml-validate.py +++ b/tools/yaml-validate.py @@ -44,6 +44,7 @@ OPTIONAL_SECTIONS = ['workflow_tasks', 'cellv2_discovery'] REQUIRED_DOCKER_SECTIONS = ['service_name', 'docker_config', 'puppet_config', 'config_settings'] OPTIONAL_DOCKER_SECTIONS = ['docker_puppet_tasks', 'upgrade_tasks', + 'pre_upgrade_rolling_tasks', 'fast_forward_upgrade_tasks', 'fast_forward_post_upgrade_tasks', 'post_upgrade_tasks', 'update_tasks',