Update cell0 database connection
When kolla VIP address is changed the cell0 database connection is now updated to the new address. Closes-bug: #1915302 Change-Id: I35be54efb5aaa230702d0cebaae04f1e64c3bca3 Signed-off-by: Roman Krček <roman.krcek@tietoevry.com> (cherry picked from commit ab6eb989ae6fc9fc74cd7b156ba8bc18ad5c784e)
This commit is contained in:
parent
63e625aa52
commit
de2f802371
@ -453,6 +453,7 @@ nova_compute_extra_volumes: "{{ nova_extra_volumes }}"
|
|||||||
nova_compute_ironic_extra_volumes: "{{ nova_extra_volumes }}"
|
nova_compute_ironic_extra_volumes: "{{ nova_extra_volumes }}"
|
||||||
# Used by bootstrapping containers.
|
# Used by bootstrapping containers.
|
||||||
nova_cell_bootstrap_extra_volumes: "{{ nova_extra_volumes }}"
|
nova_cell_bootstrap_extra_volumes: "{{ nova_extra_volumes }}"
|
||||||
|
nova_cell_get_settings_volumes: "{{ nova_cell_bootstrap_default_volumes + nova_cell_bootstrap_extra_volumes }}"
|
||||||
|
|
||||||
nova_libvirt_volume: "{{ 'libvirtd' if enable_nova_libvirt_container | bool else '/var/lib/libvirt' }}"
|
nova_libvirt_volume: "{{ 'libvirtd' if enable_nova_libvirt_container | bool else '/var/lib/libvirt' }}"
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
BOOTSTRAP:
|
BOOTSTRAP:
|
||||||
name: "nova_list_cells"
|
name: "nova_list_cells"
|
||||||
restart_policy: oneshot
|
restart_policy: oneshot
|
||||||
volumes: "{{ nova_cell_bootstrap_default_volumes + nova_cell_bootstrap_extra_volumes }}"
|
volumes: "{{ nova_cell_get_settings_volumes }}"
|
||||||
register: existing_cells_list
|
register: existing_cells_list
|
||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when:
|
failed_when:
|
||||||
|
@ -1,24 +1,65 @@
|
|||||||
---
|
---
|
||||||
- name: Create cell0 mappings
|
- block:
|
||||||
vars:
|
- name: Create cell0 mappings
|
||||||
nova_api: "{{ nova_services['nova-api'] }}"
|
vars:
|
||||||
nova_cell0_connection: "mysql+pymysql://{{ nova_cell0_database_user }}:{{ nova_cell0_database_password }}@{{ nova_cell0_database_address }}/{{ nova_cell0_database_name }}" # noqa 204
|
nova_api: "{{ nova_services['nova-api'] }}"
|
||||||
become: true
|
nova_cell0_connection: "mysql+pymysql://{{ nova_cell0_database_user }}:{{ nova_cell0_database_password }}@{{ nova_cell0_database_address }}/{{ nova_cell0_database_name }}" # noqa 204
|
||||||
kolla_container:
|
become: true
|
||||||
action: "start_container"
|
kolla_container:
|
||||||
command: bash -c 'sudo -E kolla_set_configs && nova-manage cell_v2 map_cell0 --database_connection {{ nova_cell0_connection }}'
|
action: "start_container"
|
||||||
common_options: "{{ docker_common_options }}"
|
command: bash -c 'sudo -E kolla_set_configs && nova-manage cell_v2 map_cell0 --database_connection {{ nova_cell0_connection }}'
|
||||||
detach: False
|
common_options: "{{ docker_common_options }}"
|
||||||
image: "{{ nova_api.image }}"
|
detach: False
|
||||||
labels:
|
image: "{{ nova_api.image }}"
|
||||||
BOOTSTRAP:
|
labels:
|
||||||
name: "nova_api_map_cell0"
|
BOOTSTRAP:
|
||||||
restart_policy: oneshot
|
name: "nova_api_map_cell0"
|
||||||
volumes: "{{ nova_api_bootstrap_default_volumes + nova_api_bootstrap_extra_volumes }}"
|
restart_policy: oneshot
|
||||||
register: map_cell0
|
volumes: "{{ nova_api_bootstrap_default_volumes + nova_api_bootstrap_extra_volumes }}"
|
||||||
changed_when:
|
register: map_cell0
|
||||||
- map_cell0 is success
|
changed_when:
|
||||||
- '"Cell0 is already setup" not in map_cell0.stdout'
|
- map_cell0 is success
|
||||||
|
- '"Cell0 is already setup" not in map_cell0.stdout'
|
||||||
|
|
||||||
|
- import_role:
|
||||||
|
name: nova-cell
|
||||||
|
tasks_from: get_cell_settings.yml
|
||||||
|
vars:
|
||||||
|
nova_cell_name: "cell0"
|
||||||
|
nova_api: "{{ nova_services['nova-api'] }}"
|
||||||
|
nova_cell_get_settings_volumes: "{{ nova_api_bootstrap_default_volumes + nova_api_bootstrap_extra_volumes }}"
|
||||||
|
|
||||||
|
- name: Update cell0 mappings
|
||||||
|
vars:
|
||||||
|
nova_cell0_uuid: "00000000-0000-0000-0000-000000000000"
|
||||||
|
nova_cell0_transport_url: "none:/"
|
||||||
|
nova_cell0_connection: "mysql+pymysql://{{ nova_cell0_database_user }}:{{ nova_cell0_database_password }}@{{ nova_cell0_database_address }}/{{ nova_cell0_database_name }}" # noqa 204
|
||||||
|
nova_api: "{{ nova_services['nova-api'] }}"
|
||||||
|
become: true
|
||||||
|
kolla_container:
|
||||||
|
action: "start_container"
|
||||||
|
command: >
|
||||||
|
bash -c 'sudo -E kolla_set_configs &&
|
||||||
|
nova-manage cell_v2 update_cell
|
||||||
|
--cell_uuid {{ nova_cell0_uuid }}
|
||||||
|
--database_connection {{ nova_cell0_connection }}
|
||||||
|
--transport-url {{ nova_cell0_transport_url }}'
|
||||||
|
common_options: "{{ docker_common_options }}"
|
||||||
|
detach: False
|
||||||
|
image: "{{ nova_api.image }}"
|
||||||
|
labels:
|
||||||
|
BOOTSTRAP:
|
||||||
|
name: "nova_api_map_cell0"
|
||||||
|
restart_policy: oneshot
|
||||||
|
volumes: "{{ nova_api_bootstrap_default_volumes + nova_api_bootstrap_extra_volumes }}"
|
||||||
|
register: nova_cell0_updated
|
||||||
|
changed_when:
|
||||||
|
- nova_cell0_updated is success
|
||||||
|
failed_when:
|
||||||
|
- nova_cell0_updated.rc != 0
|
||||||
|
when:
|
||||||
|
- nova_cell_settings | length > 0
|
||||||
|
- nova_cell_settings.cell_database != nova_cell0_connection
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups[nova_api.group][0] }}"
|
delegate_to: "{{ groups[nova_api.group][0] }}"
|
||||||
|
|
||||||
|
@ -36,8 +36,7 @@ def extract_cell(list_cells_cli_output, cell_name):
|
|||||||
# NOTE(priteau): regexp doesn't support passwords containing spaces
|
# NOTE(priteau): regexp doesn't support passwords containing spaces
|
||||||
p = re.compile(
|
p = re.compile(
|
||||||
r'\| +(?P<cell_name>[^ ]+)? +'
|
r'\| +(?P<cell_name>[^ ]+)? +'
|
||||||
r'\| +(?!00000000-0000-0000-0000-000000000000)'
|
r'\| +(?P<cell_uuid>[0-9a-f\-]+) +'
|
||||||
r'(?P<cell_uuid>[0-9a-f\-]+) +'
|
|
||||||
r'\| +(?P<cell_message_queue>[^ ]+) +'
|
r'\| +(?P<cell_message_queue>[^ ]+) +'
|
||||||
r'\| +(?P<cell_database>[^ ]+) +'
|
r'\| +(?P<cell_database>[^ ]+) +'
|
||||||
r'\| +(?P<cell_disabled>[^ ]+) +'
|
r'\| +(?P<cell_disabled>[^ ]+) +'
|
||||||
|
5
releasenotes/notes/bug-1915302-a668b00dddaff476.yaml
Normal file
5
releasenotes/notes/bug-1915302-a668b00dddaff476.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fixes nova-cell not updating the cell0 database address when VIP changes.
|
||||||
|
`LP#1915302 <https://launchpad.net/bugs/1915302>`__
|
Loading…
x
Reference in New Issue
Block a user