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
This commit is contained in:
Andy McCrae 2017-03-01 16:17:07 +00:00 committed by Andy McCrae
parent 5950d99f46
commit ea6e67375d
1 changed files with 23 additions and 0 deletions

View File

@ -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