Update how neutron migrations are handled
We're seeing some neutron db sync failures in master branch (liberty). It looks like there may be a few issues with the way we're handling migrations: 1. We're not capturing the correct information in the 'Check last DB revision' task as the first line returned by 'neutron-db-manage history' is a header (this also means that the 'Inspect on disk neutron DB revision' task will never do what we intend). 2. We delegate 'Check last DB revision' to 'neutron_all' group, but in an ideal world this is probably only necessary on 'neutron_server'. 3. When stopping neutron server to run 'Perform a Neutron DB Upgrade', we're only stopping it on groups['neutron_server'][0], while all other neutron server containers are up servicing requests. 4. Perform a db stamp, which doesn't appear to be necessary. This change makes the following changes: 1. Bumps neutron SHA to include 43c00a9, which introduces new --expand / --contract upgrade options (otherwise, you have to specify liberty_expand@head / liberty_contract@head which may no longer work when neutron gets bumped in the future) 2. Checks if migrations have previously run, and if not runs a 'neutron-db-manage upgrade heads' 3. If migrations have previously run: a) it runs an online migration against expand alembic branch using 'neutron-db-manage upgrade --expand'. b) it stops all neutron-server services c) it runs an offline migration against contract alembic branch using 'neutron-db-manage upgrade --contract' d) it starts all neutron-server instances 4. It removes the temporary pin introduced in https://review.openstack.org/218572 as the SHA bump includes the upstream fix https://review.openstack.org/218723 TODO: Currently, we upgrade expand and contract branches (shutting down neutron-server in the proceses), even if there are no pending migrations. We need to find a clean way to check what migration we are on and compare to alembic HEADS file to see if we're up to date. Unfortunately, 'neutron-db-manage current' doesn't indicate which migration is in which alembic branch, so you would have to further grep for each migration in the neutron migrations code to determine the branch. NOTE: Liberty introduces the split alembic branches for online/offline migrations, see [1] for more information. [1] http://docs.openstack.org/developer/neutron/devref/alembic_migrations.html Change-Id: I1176b5fe12cad1ee732486ae179e76deea5623e1 Closes-Bug: #1486593
This commit is contained in:
parent
b2f8a07e72
commit
092f606adc
@ -66,7 +66,7 @@ keystone_git_dest: "/opt/keystone_{{ keystone_git_install_branch | replace('/',
|
|||||||
|
|
||||||
## Neutron service
|
## Neutron service
|
||||||
neutron_git_repo: https://git.openstack.org/openstack/neutron
|
neutron_git_repo: https://git.openstack.org/openstack/neutron
|
||||||
neutron_git_install_branch: 5c477abcb97fda88aa00d6d5cf17fc1a6ac9796a # HEAD of "master" as of 15.08.2015
|
neutron_git_install_branch: 72f9f09398802f2187c8cffd777b4de2ae71de77 # HEAD of "master" as of 01.09.2015
|
||||||
neutron_git_dest: "/opt/neutron_{{ neutron_git_install_branch | replace('/', '_') }}"
|
neutron_git_dest: "/opt/neutron_{{ neutron_git_install_branch | replace('/', '_') }}"
|
||||||
|
|
||||||
neutron_lbaas_git_repo: https://git.openstack.org/openstack/neutron-lbaas
|
neutron_lbaas_git_repo: https://git.openstack.org/openstack/neutron-lbaas
|
||||||
|
@ -39,66 +39,73 @@
|
|||||||
tags:
|
tags:
|
||||||
- neutron-db-setup
|
- neutron-db-setup
|
||||||
|
|
||||||
- name: Inspect on disk neutron DB revision
|
- name: Check for existing migrations
|
||||||
command: >
|
|
||||||
cat {{ neutron_system_home_folder }}/neutron-revision
|
|
||||||
failed_when: false
|
|
||||||
changed_when: neutron_revision_on_disk.rc != 0
|
|
||||||
register: neutron_revision_on_disk
|
|
||||||
tags:
|
|
||||||
- neutron-db-setup
|
|
||||||
- neutron-upgrade
|
|
||||||
- neutron-stamp
|
|
||||||
|
|
||||||
- name: Check last DB revision
|
|
||||||
shell: |
|
shell: |
|
||||||
neutron-db-manage history | head -1 | tee {{ neutron_system_home_folder }}/neutron-revision
|
neutron-db-manage --config-file {{ neutron_db_config }} --config-file {{ neutron_db_plugin }} current | egrep "^[0-9a-z]{12}"
|
||||||
register: neutron_revision
|
|
||||||
sudo: yes
|
sudo: yes
|
||||||
sudo_user: "{{ neutron_system_user_name }}"
|
sudo_user: "{{ neutron_system_user_name }}"
|
||||||
delegate_to: "{{ item }}"
|
failed_when: false
|
||||||
with_items: groups['neutron_all']
|
register: neutron_migrations_previously_run
|
||||||
tags:
|
tags:
|
||||||
- neutron-db-setup
|
- neutron-db-setup
|
||||||
- neutron-upgrade
|
- neutron-upgrade
|
||||||
- neutron-stamp
|
|
||||||
|
|
||||||
- name: Stop neutron server
|
- name: Perform an initial Neutron DB sync
|
||||||
service:
|
|
||||||
name: "neutron-server"
|
|
||||||
state: stopped
|
|
||||||
pattern: "neutron-server"
|
|
||||||
ignore_errors: true
|
|
||||||
when: neutron_revision.results.0.stdout != neutron_revision_on_disk.stdout
|
|
||||||
tags:
|
|
||||||
- neutron-db-setup
|
|
||||||
- neutron-stamp
|
|
||||||
|
|
||||||
- name: Perform a Neutron DB Upgrade
|
|
||||||
command: |
|
command: |
|
||||||
neutron-db-manage --config-file {{ neutron_db_config }}
|
neutron-db-manage --config-file {{ neutron_db_config }}
|
||||||
--config-file {{ neutron_db_plugin }}
|
--config-file {{ neutron_db_plugin }}
|
||||||
upgrade {{ neutron_db_revision }}
|
upgrade {{ neutron_db_revision }}
|
||||||
sudo: yes
|
sudo: yes
|
||||||
sudo_user: "{{ neutron_system_user_name }}"
|
sudo_user: "{{ neutron_system_user_name }}"
|
||||||
when: >
|
when: neutron_migrations_previously_run.rc == 1
|
||||||
neutron_revision.results.0.stdout != neutron_revision_on_disk.stdout
|
|
||||||
notify: Restart neutron services
|
|
||||||
tags:
|
tags:
|
||||||
- neutron-db-setup
|
- neutron-db-setup
|
||||||
- neutron-upgrade
|
- neutron-upgrade
|
||||||
- neutron-stamp
|
|
||||||
|
|
||||||
- name: Perform a Neutron DB Stamp
|
- name: Perform a Neutron DB online upgrade (expand)
|
||||||
command: |
|
command: |
|
||||||
neutron-db-manage --config-file {{ neutron_db_config }}
|
neutron-db-manage --config-file {{ neutron_db_config }}
|
||||||
--config-file {{ neutron_db_plugin }}
|
--config-file {{ neutron_db_plugin }}
|
||||||
stamp {{ neutron_db_revision }}
|
upgrade --expand
|
||||||
when: neutron_revision.results.0.stdout != neutron_revision_on_disk.stdout
|
|
||||||
sudo: yes
|
sudo: yes
|
||||||
sudo_user: "{{ neutron_system_user_name }}"
|
sudo_user: "{{ neutron_system_user_name }}"
|
||||||
notify: Restart neutron services
|
when: neutron_migrations_previously_run.rc == 0
|
||||||
|
tags:
|
||||||
|
- neutron-db-setup
|
||||||
|
- neutron-upgrade
|
||||||
|
|
||||||
|
- name: Stop Neutron server
|
||||||
|
service:
|
||||||
|
name: "neutron-server"
|
||||||
|
state: stopped
|
||||||
|
pattern: "neutron-server"
|
||||||
|
delegate_to: "{{ item }}"
|
||||||
|
with_items: groups['neutron_server']
|
||||||
|
when: neutron_migrations_previously_run.rc == 0
|
||||||
|
tags:
|
||||||
|
- neutron-db-setup
|
||||||
|
- neutron-upgrade
|
||||||
|
|
||||||
|
- name: Perform a Neutron DB offline upgrade (contract)
|
||||||
|
command: |
|
||||||
|
neutron-db-manage --config-file {{ neutron_db_config }}
|
||||||
|
--config-file {{ neutron_db_plugin }}
|
||||||
|
upgrade --contract
|
||||||
|
sudo: yes
|
||||||
|
sudo_user: "{{ neutron_system_user_name }}"
|
||||||
|
when: neutron_migrations_previously_run.rc == 0
|
||||||
|
tags:
|
||||||
|
- neutron-db-setup
|
||||||
|
- neutron-upgrade
|
||||||
|
|
||||||
|
- name: Start neutron server
|
||||||
|
service:
|
||||||
|
name: "neutron-server"
|
||||||
|
state: started
|
||||||
|
pattern: "neutron-server"
|
||||||
|
delegate_to: "{{ item }}"
|
||||||
|
with_items: groups['neutron_server']
|
||||||
|
when: neutron_migrations_previously_run.rc == 0
|
||||||
tags:
|
tags:
|
||||||
- neutron-db-setup
|
- neutron-db-setup
|
||||||
- neutron-upgrade
|
- neutron-upgrade
|
||||||
- neutron-stamp
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
cloudlib>=0.3.0 # scripts/os-ansible-role-requirements.py
|
cloudlib>=0.3.0 # scripts/os-ansible-role-requirements.py
|
||||||
Jinja2>=2.6 # ansible
|
Jinja2>=2.6 # ansible
|
||||||
netaddr>=0.7.12,<0.7.16 # playbooks/inventory/dynamic_inventory.py
|
netaddr>=0.7.12 # playbooks/inventory/dynamic_inventory.py
|
||||||
paramiko>=1.13.0 # ansible
|
paramiko>=1.13.0 # ansible
|
||||||
pip>=6.0
|
pip>=6.0
|
||||||
PrettyTable>=0.7,<0.8 # scripts/inventory-manage.py
|
PrettyTable>=0.7,<0.8 # scripts/inventory-manage.py
|
||||||
|
Loading…
Reference in New Issue
Block a user