Merge "FFU: Introduce post FFU steps and use them for qeens switch"

This commit is contained in:
Zuul 2018-03-15 23:55:03 +00:00 committed by Gerrit Code Review
commit e3a0b6bb2a
4 changed files with 72 additions and 7 deletions

View File

@ -76,8 +76,8 @@ parameters:
default: []
FastForwardUpgradeReleases:
type: comma_delimited_list
default: ['ocata', 'pike']
description: List of releases to fast forward through during upgrade.
default: ['ocata', 'pike', 'queens']
description: List of releases to fast forward through during upgrade. Last release in list is used for post steps.
conditions:
{% for step in range(1, deploy_steps_max) %}
@ -565,10 +565,20 @@ outputs:
- hosts: overcloud
become: true
tasks:
- set_fact:
releases: {get_param: [FastForwardUpgradeReleases]}
{% raw %}
- set_fact:
ffu_releases: "{{ releases | difference( releases | last )}}"
- include_tasks: fast_forward_upgrade_release_tasks.yaml
loop_control:
loop_var: release
with_items: {get_param: [FastForwardUpgradeReleases]}
with_items: '{{ ffu_releases }}'
- set_fact:
release: "{{ releases | last }}"
ffu_packages_apply: True
{% endraw %}
- include_tasks: fast_forward_upgrade_post_role_tasks.yaml
fast_forward_upgrade_release_tasks: |
- include_tasks: fast_forward_upgrade_prep_tasks.yaml
- include_tasks: fast_forward_upgrade_bootstrap_tasks.yaml
@ -593,9 +603,11 @@ outputs:
tags: common
command: hiera -c /etc/puppet/hiera.yaml bootstrap_nodeid
register: bootstrap_node
- name: set is_bootstrap_node fact
- name: set is_bootstrap_node ffu_packages_bootstrap_only facts
tags: common
set_fact: is_bootstrap_node={{bootstrap_node.stdout|lower == ansible_hostname|lower}}
set_fact:
is_bootstrap_node={{bootstrap_node.stdout|lower == ansible_hostname|lower}}
ffu_packages_apply={{bootstrap_node.stdout|lower == ansible_hostname|lower}}
{% endraw %}
- name: Create /var/lib/docker-puppet
file: path=/var/lib/docker-puppet state=directory setype=svirt_sandbox_file_t selevel=s0 recurse=true
@ -605,6 +617,17 @@ outputs:
with_sequence: start=0 end={{fast_forward_upgrade_prep_steps_max}}
loop_control:
loop_var: step
fast_forward_upgrade_post_role_tasks: |
{%- for role in roles %}
- include_tasks: {{role.name}}/fast_forward_post_upgrade_tasks.yaml
when: role_name == '{{role.name}}'
{%- endfor %}
- name: Openstack Heat Agents package update
yum: name=openstack-heat-agents state=latest
- name: Update os-collect-config
yum: name=os-collect-config state=latest
- name: Start os-collect-config back up
service: name=os-collect-config state=started enabled=yes
fast_forward_upgrade_prep_role_tasks: |
{%- for role in roles %}
- include_tasks: {{role.name}}/fast_forward_upgrade_tasks.yaml

View File

@ -253,6 +253,15 @@ resources:
expression: coalesce($.data, []).where($ != null).select($.get('fast_forward_upgrade_tasks')).where($ != null).flatten().distinct()
data: {get_attr: [ServiceChain, role_data]}
FastForwardPostUpgradeTasks:
type: OS::Heat::Value
properties:
type: comma_delimited_list
value:
yaql:
expression: coalesce($.data, []).where($ != null).select($.get('fast_forward_post_upgrade_tasks')).where($ != null).flatten().distinct()
data: {get_attr: [ServiceChain, role_data]}
UpgradeTasks:
type: OS::Heat::Value
properties:
@ -356,6 +365,7 @@ outputs:
external_deploy_tasks: {get_attr: [ExternalDeployTasks, value]}
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]}
upgrade_tasks: {get_attr: [UpgradeTasks, value]}
post_upgrade_tasks: {get_attr: [PostUpgradeTasks, value]}
update_tasks: {get_attr: [UpdateTasks, value]}

View File

@ -38,7 +38,7 @@ parameters:
default: 'tripleo-repos'
type: string
FastForwardRepoArgs:
default: {'tripleo_repos': {'ocata': '-b ocata current', 'pike': '-b pike current'}}
default: {'tripleo_repos': {'ocata': '-b ocata current', 'pike': '-b pike current', 'queens': '-b queens current'}}
type: json
outputs:
@ -117,5 +117,26 @@ outputs:
command: "tripleo-repos {{ fast_forward_repo_args.tripleo_repos[release] }}"
when:
- step|int == 3
- is_bootstrap_node|bool
- ffu_packages_apply|bool
- fast_forward_repo_type == 'tripleo-repos'
fast_forward_post_upgrade_tasks:
- name: Register repo type and args
set_fact:
fast_forward_repo_type: {get_param: FastForwardRepoType}
fast_forward_repo_args: {get_param: FastForwardRepoArgs}
- debug:
msg: "fast_forward_repo_type: {{ fast_forward_repo_type }} fast_forward_repo_args: {{ fast_forward_repo_args }}"
- block:
- name: clone tripleo-repos
git:
repo: https://github.com/openstack/tripleo-repos.git
dest: /home/stack/tripleo-repos/
- name: install tripleo-repos
command: python setup.py install
args:
chdir: /home/stack/tripleo-repos/
- name: Enable tripleo-repos
command: "tripleo-repos {{ fast_forward_repo_args.tripleo_repos[release] }}"
when:
- ffu_packages_apply|bool
- fast_forward_repo_type == 'tripleo-repos'

View File

@ -45,6 +45,7 @@ REQUIRED_DOCKER_SECTIONS = ['service_name', 'docker_config', 'puppet_config',
'config_settings']
OPTIONAL_DOCKER_SECTIONS = ['docker_puppet_tasks', 'upgrade_tasks',
'fast_forward_upgrade_tasks',
'fast_forward_post_upgrade_tasks',
'post_upgrade_tasks', 'update_tasks',
'post_update_tasks', 'service_config_settings',
'host_prep_tasks', 'metadata_settings',
@ -524,6 +525,11 @@ def validate_docker_service(filename, tpl):
print('ERROR: fast_forward_upgrade_tasks validation failed')
return 1
if 'fast_forward_post_upgrade_tasks' in role_data and role_data['fast_forward_post_upgrade_tasks']:
if validate_upgrade_tasks(role_data['fast_forward_post_upgrade_tasks']):
print('ERROR: fast_forward_post_upgrade_tasks validation failed')
return 1
if 'parameters' in tpl:
for param in required_params:
if param not in tpl['parameters']:
@ -581,6 +587,11 @@ def validate_service(filename, tpl):
print('ERROR: fast_forward_upgrade_tasks validation failed')
return 1
if 'fast_forward_post_upgrade_tasks' in role_data and role_data['fast_forward_post_upgrade_tasks']:
if validate_upgrade_tasks(role_data['fast_forward_post_upgrade_tasks']):
print('ERROR: fast_forward_post_upgrade_tasks validation failed')
return 1
if 'parameters' in tpl:
for param in required_params:
if param not in tpl['parameters']: