From f08408bf5c75c93fe76603ebbe5d8f4fa6ee63d3 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Wed, 14 Aug 2019 10:47:40 +0200 Subject: [PATCH] osd: refact 'wait for all osd to be up' task let's use `until` instead of doing test in bash using python oneliner also, use `command` instead of `shell`. Signed-off-by: Guillaume Abrioux (cherry picked from commit 687087fd43c0ddcadf569ad0ffaac62eac59756f) --- roles/ceph-osd/tasks/openstack_config.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/roles/ceph-osd/tasks/openstack_config.yml b/roles/ceph-osd/tasks/openstack_config.yml index c774ed685..f08fcd6af 100644 --- a/roles/ceph-osd/tasks/openstack_config.yml +++ b/roles/ceph-osd/tasks/openstack_config.yml @@ -1,15 +1,14 @@ --- - name: wait for all osd to be up - shell: > - test "$({{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | {{ discovered_interpreter_python }} -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["osdmap"]["num_osds"])')" -gt 0 && - test "$({{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | {{ discovered_interpreter_python -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["osdmap"]["num_osds"])')" = - "$({{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | {{ discovered_interpreter_python }} -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["osdmap"]["num_up_osds"])')" + command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json" register: wait_for_all_osds_up retries: "{{ nb_retry_wait_osd_up }}" delay: "{{ delay_wait_osd_up }}" changed_when: false delegate_to: "{{ groups[mon_group_name][0] }}" - until: wait_for_all_osds_up.rc == 0 + until: + - (wait_for_all_osds_up.stdout | from_json)["osdmap"]["osdmap"]["num_osds"] | int > 0 + - (wait_for_all_osds_up.stdout | from_json)["osdmap"]["osdmap"]["num_osds"] == (wait_for_all_osds_up.stdout | from_json)["osdmap"]["osdmap"]["num_up_osds"] - name: pool related tasks block: