Merge "Implement data migrations for rolling upgrades"

This commit is contained in:
Jenkins 2017-06-19 23:42:07 +00:00 committed by Gerrit Code Review
commit 13f75d0ed1
4 changed files with 91 additions and 4 deletions

View File

@ -0,0 +1,9 @@
---
features:
- The ``os_cinder`` role now provides for doing
online data migrations once the db sync has
been completed. The data migrations will not
be executed until the boolean variable
``cinder_all_software_updated`` is true. This
variable will need to be set by the playbook
consuming the role.

View File

@ -17,4 +17,45 @@
command: "{{ cinder_bin }}/cinder-manage db sync"
become: yes
become_user: "{{ cinder_system_user_name }}"
when:
- "ansible_local['openstack_ansible']['cinder']['need_db_sync'] | bool"
changed_when: false
register: dbsync
- name: Disable the db sync requirement
ini_file:
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
section: cinder
option: need_db_sync
value: False
when:
- dbsync | succeeded
- name: Record the need for online data migrations
ini_file:
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
section: cinder
option: need_online_data_migrations
value: True
when:
- dbsync | succeeded
- name: Perform online data migrations
command: "{{ cinder_bin }}/cinder-manage db online-data-migrations"
become: yes
become_user: "{{ cinder_system_user_name }}"
when:
- "(cinder_all_software_updated | default('no')) | bool"
- "ansible_local['openstack_ansible']['cinder']['need_online_data_migrations'] | bool"
changed_when: false
register: data_migrations
- name: Disable the online migrations requirement
ini_file:
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
section: cinder
option: need_online_data_migrations
value: False
when:
- data_migrations | succeeded

View File

@ -112,6 +112,36 @@
virtualenv-tools --update-path=auto --reinitialize {{ cinder_bin | dirname }}
when: cinder_get_venv | changed
- name: Record the need for a db sync
ini_file:
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
section: cinder
option: need_db_sync
value: True
when: cinder_get_venv | changed or
cinder_venv_dir | changed or
install_packages | changed
- name: Initialise the online data migration local fact
ini_file:
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
section: cinder
option: need_online_data_migrations
value: False
when: cinder_get_venv | changed or
cinder_venv_dir | changed or
install_packages | changed
- name: Record the need for a service restart
ini_file:
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
section: cinder
option: need_service_restart
value: True
when: cinder_get_venv | changed or
cinder_venv_dir | changed or
install_packages | changed
- name: Record the venv tag deployed
ini_file:
dest: "/etc/ansible/facts.d/openstack_ansible.fact"

View File

@ -33,21 +33,28 @@
tags:
- cinder-install
- name: refresh local facts
setup:
filter: ansible_local
gather_subset: "!all"
tags:
- cinder-config
- include: cinder_post_install.yml
tags:
- cinder-config
- include: cinder_db_setup.yml
when:
- groups['cinder_all'] | length > 0
- inventory_hostname == groups['cinder_all'][0]
- groups['cinder_api'] | length > 0
- inventory_hostname == groups['cinder_api'][0]
tags:
- cinder-config
- include: cinder_service_setup.yml
when:
- groups['cinder_all'] | length > 0
- inventory_hostname == groups['cinder_all'][0]
- groups['cinder_api'] | length > 0
- inventory_hostname == groups['cinder_api'][0]
tags:
- cinder-config