Use template URLs in Cell Mappings
In Rocky Nova has implemented templating in Cell Mappings [1] That means that instead of hardcoding connection details in database, we can just put a template there. Variables are parsed from nova.conf and substituted on the service load. Thus we don't need to update cells every time we change passoword and we can use different credentials across nodes since they will be just taken from config files. We also perform upgrade of the cells to the templates when cell exist. Task `Map instances to new Cell1` is removed, since it's required to map instances to cellv2 only during upgrade from cellsv1 to cellsv2 which is not the case nowadays or when migrating instances between cells [2]. [1] https://docs.openstack.org/nova/latest/user/cells.html#template-urls-in-cell-mappings [2] https://docs.openstack.org/nova/rocky/cli/nova-manage.html#nova-cells-v2 Change-Id: Ia6bef7b902c0fb99a529c592172226bb16ed0d9d
This commit is contained in:
parent
f7858e9440
commit
c6d4c6207f
@ -0,0 +1,9 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
During upgrade your current Nova cell mapings will be converted to usage
|
||||
of the `Template URLs <https://docs.openstack.org/nova/latest/user/cells.html#template-urls-in-cell-mappings>`_.
|
||||
This means, that your changes of transport_url or [database]/connection
|
||||
in ``nova.conf`` will be reflected by nova-conductor in cells just after
|
||||
service restart, without need to explicitly run
|
||||
``nova-manage cell_v2 update_cell``.
|
@ -55,11 +55,22 @@
|
||||
- data_migrations is not skipped
|
||||
- data_migrations is succeeded
|
||||
|
||||
# We need to check for existance of the cell, since nova-manage cell_v2 create_cell
|
||||
# might be not idempotent due to the bug https://bugs.launchpad.net/nova/+bug/1923899
|
||||
- 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 }}"
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
register: _cell_uuid
|
||||
|
||||
- name: Create the cell1 mapping entry in the nova API DB
|
||||
command: >-
|
||||
{{ nova_bin }}/nova-manage cell_v2 create_cell
|
||||
--name {{ nova_cell1_name }}
|
||||
--database_connection mysql+pymysql://{{ nova_galera_user }}:{{ nova_container_mysql_password }}@{{ nova_galera_address }}/{{ nova_galera_database }}?charset=utf8
|
||||
--database_connection {scheme}://{username}:{password}@{hostname}/{path}?{query}
|
||||
--transport-url {scheme}://{username}:{password}@{hostname}//{path}?{query}
|
||||
become: yes
|
||||
become_user: "{{ nova_system_user_name }}"
|
||||
register: nova_cell1_create
|
||||
@ -69,23 +80,20 @@
|
||||
# 0: the cell mapping record in the nova API database was
|
||||
# successfully implemented (greenfield install)
|
||||
# 2: the cell mapping record in the nova API database already
|
||||
# exists (brownfield install)
|
||||
# exists (brownfield install). This is not working for templates
|
||||
# because of the bug https://bugs.launchpad.net/nova/+bug/1923899
|
||||
failed_when: "nova_cell1_create.rc not in [0, 2]"
|
||||
changed_when: "nova_cell1_create.rc == 0"
|
||||
when: "_cell_uuid.rc == 1"
|
||||
|
||||
# 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
|
||||
when: "nova_cell1_create.rc == 0"
|
||||
|
||||
- name: Map instances to new Cell1
|
||||
command: "{{ nova_bin }}/nova-manage cell_v2 map_instances --cell_uuid {{ cell1_uuid['stdout'].split()[3] }}"
|
||||
# TODO(noonedeadpunk): Remove this task in X release
|
||||
- name: "Upgrade {{ nova_cell1_name }} to use template for connection"
|
||||
command: >-
|
||||
{{ nova_bin }}/nova-manage cell_v2 update_cell
|
||||
--cell_uuid {{ _cell_uuid['stdout'].split()[3] }}
|
||||
--database_connection {scheme}://{username}:{password}@{hostname}/{path}?{query}
|
||||
--transport-url {scheme}://{username}:{password}@{hostname}//{path}?{query}
|
||||
become: yes
|
||||
become_user: "{{ nova_system_user_name }}"
|
||||
changed_when: false
|
||||
when: "nova_cell1_create.rc == 0"
|
||||
when: "_cell_uuid.rc == 0"
|
||||
|
Loading…
x
Reference in New Issue
Block a user