switch_to_container: refact wait for pg check

There is no need to make this check with several steps.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/5387/head
Guillaume Abrioux 2020-05-15 10:58:40 +02:00
parent 8d556b0787
commit 8aed824f71
1 changed files with 1 additions and 8 deletions

View File

@ -306,12 +306,6 @@
name: ceph-osd name: ceph-osd
post_tasks: post_tasks:
- name: get num_pgs
command: >
{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph --cluster {{ cluster }} -s --format json
register: ceph_pgs
delegate_to: "{{ groups[mon_group_name][0] }}"
- name: container - waiting for clean pgs... - name: container - waiting for clean pgs...
command: > command: >
{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph --cluster {{ cluster }} -s --format json {{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph --cluster {{ cluster }} -s --format json
@ -319,11 +313,10 @@
until: > until: >
(((ceph_health_post.stdout | from_json).pgmap.pgs_by_state | length) > 0) (((ceph_health_post.stdout | from_json).pgmap.pgs_by_state | length) > 0)
and and
(((ceph_health_post.stdout | from_json).pgmap.pgs_by_state | selectattr('state_name', 'search', '^active\\+clean') | map(attribute='count') | list | sum) == (ceph_pgs.stdout | from_json).pgmap.num_pgs) (((ceph_health_post.stdout | from_json).pgmap.pgs_by_state | selectattr('state_name', 'search', '^active\\+clean') | map(attribute='count') | list | sum) == (ceph_health_post.stdout | from_json).pgmap.num_pgs)
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
retries: "{{ health_osd_check_retries }}" retries: "{{ health_osd_check_retries }}"
delay: "{{ health_osd_check_delay }}" delay: "{{ health_osd_check_delay }}"
when: (ceph_pgs.stdout | from_json).pgmap.num_pgs != 0
- name: unset osd flags - name: unset osd flags