Fix Newton cinder-manage check used in db-upgrades

cinder-manage service list does not output a usable, full, hostname;
just the short hostname is output.  To fix this we need to query the
database directly.

We also change the behavior of this operation to drop all services.  We
do this at the recommendation of upstream cinder.  This is safe because
all cinder services are stopped and the services will re-register when
restarted.

Related-Bug: #1712372
Change-Id: I6d845165ec22d4c2aeece0636a550e0b57050c22
This commit is contained in:
Matthew Thode 2017-08-21 16:11:12 -05:00
parent 6437ea37db
commit 575c9b7b12
No known key found for this signature in database
GPG Key ID: 64A37BEAAE19A4E8

View File

@ -41,16 +41,20 @@
hosts: "cinder_all[0]" hosts: "cinder_all[0]"
user: root user: root
tasks: tasks:
- name: Check the service list
shell: mysql -Be 'select `binary`,`host` from services;' cinder | awk '{if (NR!=1) {print $1, $2}}'
args:
executable: /bin/bash
changed_when: false
delegate_to: "{{ groups['utility_all'][0] }}"
register: cinder_service_list
- name: Perform a cinder DB sync - name: Perform a cinder DB sync
command: "{{ venv_path }}/bin/cinder-manage db sync" command: "{{ venv_path }}/bin/cinder-manage db sync"
- name: Perform service purge - name: Perform service purge
shell: | shell: "{{ venv_path }}/bin/cinder-manage service remove {{ item }}"
IFS=$'\n'
for i in $({{ venv_path }}/bin/cinder-manage service list | awk '/None/ {print $1, $2}'); do
eval "{{ venv_path }}/bin/cinder-manage service remove $i"
done
args: args:
executable: /bin/bash executable: /bin/bash
with_items: "{{ cinder_service_list.stdout_lines }}"
- name: Nova DB Migrations - name: Nova DB Migrations
hosts: "nova_api_os_compute[0]" hosts: "nova_api_os_compute[0]"