diff --git a/releasenotes/notes/nova_cell_templates-17775e06169ff926.yaml b/releasenotes/notes/nova_cell_templates-17775e06169ff926.yaml new file mode 100644 index 00000000..69fa7442 --- /dev/null +++ b/releasenotes/notes/nova_cell_templates-17775e06169ff926.yaml @@ -0,0 +1,9 @@ +--- +upgrade: + - | + During upgrade your current Nova cell mapings will be converted to usage + of the `Template URLs `_. + 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``. diff --git a/tasks/nova_db_setup.yml b/tasks/nova_db_setup.yml index 021b9dfd..90feabe1 100644 --- a/tasks/nova_db_setup.yml +++ b/tasks/nova_db_setup.yml @@ -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"