From d3b3c8948ef47d79cb32c328eb8df275fe589ac1 Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Fri, 10 Jul 2020 15:24:24 -0400 Subject: [PATCH] cephadm-adopt: add osd flags during adoption Like rolling_update or switch2container playbooks, we need to set/unset some osd flags before and after the OSD daemons adoption. This also adds a task for waiting for clean pgs at then of an OSd node. Signed-off-by: Dimitri Savineau --- infrastructure-playbooks/cephadm-adopt.yml | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/infrastructure-playbooks/cephadm-adopt.yml b/infrastructure-playbooks/cephadm-adopt.yml index 5528c9a76..42ce8ddc7 100644 --- a/infrastructure-playbooks/cephadm-adopt.yml +++ b/infrastructure-playbooks/cephadm-adopt.yml @@ -380,6 +380,24 @@ state: absent when: not containerized_deployment | bool +- name: set osd flags + hosts: "{{ mon_group_name|default('mons') }}" + become: true + gather_facts: false + tasks: + - import_role: + name: ceph-defaults + + - name: set osd flags + command: "cephadm shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} osd set {{ item }}" + run_once: true + changed_when: false + with_items: + - noout + - nodeep-scrub + environment: + CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}' + - name: adopt ceph osd daemons hosts: "{{ osd_group_name|default('osd') }}" serial: 1 @@ -446,6 +464,38 @@ state: absent when: not containerized_deployment | bool + - name: waiting for clean pgs... + command: "cephadm shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} -s --format json" + changed_when: false + register: ceph_health_post + until: > + (((ceph_health_post.stdout | from_json).pgmap.pgs_by_state | length) > 0) + and + (((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] }}" + retries: "{{ health_osd_check_retries }}" + delay: "{{ health_osd_check_delay }}" + environment: + CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}' + +- name: unset osd flags + hosts: "{{ mon_group_name|default('mons') }}" + become: true + gather_facts: false + tasks: + - import_role: + name: ceph-defaults + + - name: unset osd flags + command: "cephadm shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} osd unset {{ item }}" + run_once: true + changed_when: false + with_items: + - noout + - nodeep-scrub + environment: + CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}' + - name: redeploy mds daemons hosts: "{{ mon_group_name|default('mons') }}" become: true -- 2.39.5