Rearrange cell mapping tasks
Existing instances can be mapped to a newly created cell immediately after the cell is created and by the same conductor host that created the cell. After a new compute host is built, it will need to mapped to a cell through the 'discover_hosts' command of nova-manage. This command will still need to be run against a host that has direct database access, but the command is able to handle mapping of all compute hosts that do not currently belong to the cell so it only needs to be run once per play. There can be a short delay in the time between a compute service starting and becoming available to be discovered and mapped but, for most deployments, compute host discovery will be handled automatically as a periodic task. Change-Id: I4f7328e1aff79eb94f278999b97fbad8f44c6a3e Closes-Bug: 1749037 Related-Bug: 1729661 Related-Bug: 1752540
This commit is contained in:
parent
fed3300959
commit
6321cf9030
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user