Merge "Rearrange cell mapping tasks"

This commit is contained in:
Zuul 2018-03-14 12:57:42 +00:00 committed by Gerrit Code Review
commit e3e7c1f00b
3 changed files with 22 additions and 26 deletions

View File

@ -125,15 +125,12 @@
# because the compute hosts do not have access to
# the database connection string and therefore
# cannot run nova-manage.
# Also, we delegate this to a random host in the
# conductor group in order to spread the load of
# multiple forks across the group members.
- include_tasks: nova_db_post_setup.yml
delegate_to: "{{ conductor_host }}"
with_random_choice: "{{ groups['nova_conductor'] }}"
loop_control:
loop_var: conductor_host
- import_tasks: nova_db_post_setup.yml
delegate_to: "{{ random_conductor }}"
run_once: true
when:
- "nova_services['nova-compute']['group'] in group_names"
vars:
random_conductor: "{{ groups[nova_services['nova-conductor']['group']] | random }}"
tags:
- nova-config

View File

@ -15,9 +15,8 @@
- name: Set the delegated task facts
set_fact:
_db_nova_bin: "{{ hostvars[conductor_host]['nova_bin'] | default(nova_bin) }}"
_db_nova_system_user_name: "{{ hostvars[conductor_host]['nova_system_user_name'] | default(nova_system_user_name) }}"
_db_nova_cell1_name: "{{ hostvars[conductor_host]['nova_cell1_name'] | default(nova_cell1_name) }}"
_db_nova_bin: "{{ hostvars[random_conductor]['nova_bin'] | default(nova_bin) }}"
_db_nova_system_user_name: "{{ hostvars[random_conductor]['nova_system_user_name'] | default(nova_system_user_name) }}"
# This needs to be done after Compute hosts are added.
- name: Perform a cell_v2 discover
@ -25,18 +24,3 @@
become: yes
become_user: "{{ _db_nova_system_user_name }}"
changed_when: false
# When upgrading we need to map existing instances to the new cell1
# To do this we need the cell UUID.
- name: Get UUID of new Nova Cell
shell: "{{ _db_nova_bin }}/nova-manage cell_v2 list_cells | grep ' {{ _db_nova_cell1_name }} '"
become: yes
become_user: "{{ _db_nova_system_user_name }}"
register: cell1_uuid
changed_when: false
- name: Map instances to new Cell1
command: "{{ _db_nova_bin }}/nova-manage cell_v2 map_instances --cell_uuid {{ cell1_uuid['stdout'].split()[3] }}"
become: yes
become_user: "{{ _db_nova_system_user_name }}"
changed_when: false

View File

@ -73,3 +73,18 @@
when:
- not data_migrations | skipped
- data_migrations | succeeded
# When upgrading we need to map existing instances to the new cell1
# To do this we need the cell UUID.
- name: Get UUID of new Nova Cell
shell: "{{ nova_bin }}/nova-manage cell_v2 list_cells | grep ' {{ nova_cell1_name }} '"
become: yes
become_user: "{{ nova_system_user_name }}"
register: cell1_uuid
changed_when: false
- name: Map instances to new Cell1
command: "{{ nova_bin }}/nova-manage cell_v2 map_instances --cell_uuid {{ cell1_uuid['stdout'].split()[3] }}"
become: yes
become_user: "{{ nova_system_user_name }}"
changed_when: false