From ea6e67375d9d946136cd1981b446025674ff23f0 Mon Sep 17 00:00:00 2001 From: Andy McCrae Date: Wed, 1 Mar 2017 16:17:07 +0000 Subject: [PATCH] Adjust ordering for nova_db_setup Running an api_db sync on an existing cluster without cells, for example in an N->O upgrade requires the cells to have been setup. Changing the ordering to setup the cells first before running the api_db sync will resolve this. However, in a greenfield deploy we require the api_db sync to happen before we can create a cell. We should test to see if the api_db version is 0 (it hasn't been setup yet) and then run the api_db sync if it hasn't, otherwise skip to create the cell. Closes-Bug: #1667127 Change-Id: If3fff46dd581294ef44cad0a1626b68229bca060 --- tasks/nova_db_setup.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tasks/nova_db_setup.yml b/tasks/nova_db_setup.yml index 62c6bf47..21d0dd16 100644 --- a/tasks/nova_db_setup.yml +++ b/tasks/nova_db_setup.yml @@ -13,11 +13,24 @@ # See the License for the specific language governing permissions and # limitations under the License. +- name: Get the api_db version + command: "{{ nova_bin }}/nova-manage api_db version" + become: yes + become_user: "{{ nova_system_user_name }}" + register: nova_api_db_version + changed_when: false + tags: + - nova-db-setup + - nova-setup + - nova-command-bin + - name: Perform a Nova API DB sync command: "{{ nova_bin }}/nova-manage --config-file /etc/nova/nova.conf api_db sync" become: yes become_user: "{{ nova_system_user_name }}" changed_when: false + when: + - nova_api_db_version.stdout == "0" tags: - nova-db-setup - nova-setup @@ -45,6 +58,16 @@ - nova-setup - nova-command-bin +- name: Perform a Nova API DB sync + command: "{{ nova_bin }}/nova-manage --config-file /etc/nova/nova.conf api_db sync" + become: yes + become_user: "{{ nova_system_user_name }}" + changed_when: false + tags: + - nova-db-setup + - nova-setup + - nova-command-bin + - name: Perform a Nova DB sync command: "{{ nova_bin }}/nova-manage --config-file /etc/nova/nova.conf db sync" become: yes