Skip to content

Commit

Permalink
rolling_update: use ceph health instead of ceph -s
Browse files Browse the repository at this point in the history
The ceph status command returns a lot of information stored in variables
and/or facts which could consume resources for nothing.
When checking the cluster health, we're using the health structure in the
ceph status output.
To optimize this, we could use the ceph health command which contains
the same needed information.

$ ceph status -f json | wc -c
2001
$ ceph health -f json | wc -c
46

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit acddf4f)
  • Loading branch information
dsavineau committed Nov 3, 2020
1 parent bcd2797 commit 522e183
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions infrastructure-playbooks/rolling_update.yml
Expand Up @@ -136,8 +136,8 @@

- block:
- name: get ceph cluster status
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} -s -f json"
register: check_cluster_status
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} health -f json"
register: check_cluster_health
delegate_to: "{{ mon_host }}"

- block:
Expand All @@ -148,7 +148,7 @@
- name: fail if cluster isn't in an acceptable state
fail:
msg: "cluster is not in an acceptable state!"
when: (check_cluster_status.stdout | from_json).health.status == 'HEALTH_ERR'
when: (check_cluster_health.stdout | from_json).status == 'HEALTH_ERR'
when: inventory_hostname == groups[mon_group_name] | first

- name: ensure /var/lib/ceph/bootstrap-rbd-mirror is present
Expand Down

0 comments on commit 522e183

Please sign in to comment.