mirror of https://github.com/ceph/ceph-ansible.git
osds: use ceph osd stat instead of ceph status
Improve the checked way of the OSD created checking process.
This replaces the ceph status command by the ceph osd stat command.
The osdmap structure isn't needed anymore.
$ ceph status -f json | wc -c
2001
$ ceph osd stat -f json | wc -c
132
$ time ceph status -f json > /dev/null
real 0m0.563s
user 0m0.526s
sys 0m0.036s
$ time ceph osd stat -f json > /dev/null
real 0m0.457s
user 0m0.411s
sys 0m0.045s
Signed-off-by: wangxiaotong <wangxiaotong@fiberhome.com>
(cherry picked from commit b9cb0f12e9
)
pull/6008/head
parent
61001660bb
commit
8bc0806f10
|
@ -76,15 +76,15 @@
|
||||||
- inventory_hostname == ansible_play_hosts_all | last
|
- inventory_hostname == ansible_play_hosts_all | last
|
||||||
|
|
||||||
- name: wait for all osd to be up
|
- name: wait for all osd to be up
|
||||||
command: "{{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} -s -f json"
|
command: "{{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd stat -f json"
|
||||||
register: wait_for_all_osds_up
|
register: wait_for_all_osds_up
|
||||||
retries: "{{ nb_retry_wait_osd_up }}"
|
retries: "{{ nb_retry_wait_osd_up }}"
|
||||||
delay: "{{ delay_wait_osd_up }}"
|
delay: "{{ delay_wait_osd_up }}"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
delegate_to: "{{ groups[mon_group_name][0] }}"
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
||||||
until:
|
until:
|
||||||
- (wait_for_all_osds_up.stdout | from_json)["osdmap"]["osdmap"]["num_osds"] | int > 0
|
- (wait_for_all_osds_up.stdout | from_json)["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"]
|
- (wait_for_all_osds_up.stdout | from_json)["osdmap"]["num_osds"] == (wait_for_all_osds_up.stdout | from_json)["osdmap"]["num_up_osds"]
|
||||||
when:
|
when:
|
||||||
- not ansible_check_mode
|
- not ansible_check_mode
|
||||||
- inventory_hostname == ansible_play_hosts_all | last
|
- inventory_hostname == ansible_play_hosts_all | last
|
||||||
|
|
Loading…
Reference in New Issue