From 9a42fe580f59d339471815f74cfad27dfb1705ab Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Tue, 26 Nov 2019 11:09:11 -0500 Subject: [PATCH] ceph-osd: wait for all osd before crush rules When creating crush rules with device class parameter we need to be sure that all OSDs are up and running because the device class list is is populated with this information. This is now enable for all scenario not openstack_config only. Signed-off-by: Dimitri Savineau (cherry picked from commit cf8c6a384999be8caedce1121dfd57ae114d5bb6) --- roles/ceph-osd/tasks/main.yml | 11 +++++++++++ roles/ceph-osd/tasks/openstack_config.yml | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/roles/ceph-osd/tasks/main.yml b/roles/ceph-osd/tasks/main.yml index 2344b0d4a..3c4554aad 100644 --- a/roles/ceph-osd/tasks/main.yml +++ b/roles/ceph-osd/tasks/main.yml @@ -89,6 +89,17 @@ - name: include_tasks start_osds.yml include_tasks: start_osds.yml +- name: wait for all osd to be up + command: "{{ hostvars[groups[mon_group_name][0]]['docker_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.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: include crush_rules.yml include_tasks: crush_rules.yml when: diff --git a/roles/ceph-osd/tasks/openstack_config.yml b/roles/ceph-osd/tasks/openstack_config.yml index 150e528ed..f8c477bc4 100644 --- a/roles/ceph-osd/tasks/openstack_config.yml +++ b/roles/ceph-osd/tasks/openstack_config.yml @@ -1,15 +1,4 @@ --- -- name: wait for all osd to be up - command: "{{ hostvars[groups[mon_group_name][0]]['docker_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.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: - name: list existing pool(s) -- 2.39.5