osds: wait for osds to be up before creating pools

This is a follow up on #2628.
Even with the openstack pools creation moved later in the playbook,
there is still an issue because OSDs are not all UP when trying to
create pools.

Adding a task which checks for all OSDs to be UP with a `retries/until`
condition should definitively fix this issue.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1578086

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/2685/head
Guillaume Abrioux 2018-06-01 10:38:46 +02:00
parent 0b67f42feb
commit 9d5265fe11
1 changed files with 10 additions and 0 deletions

View File

@ -1,4 +1,14 @@
---
- name: wait for all osd to be up
shell: >
test "$({{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["osdmap"]["num_osds"])')" =
"$({{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["osdmap"]["num_up_osds"])')"
register: wait_for_all_osds_up
retries: 30
delay: 10
delegate_to: "{{ groups[mon_group_name][0] }}"
until: wait_for_all_osds_up.rc == 0
- name: list existing pool(s)
command: >
{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }}