]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
shrink-mds: ensure max_mds is always honored
authorGuillaume Abrioux <gabrioux@redhat.com>
Fri, 3 Jan 2020 14:56:43 +0000 (15:56 +0100)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Wed, 8 Jan 2020 16:18:45 +0000 (11:18 -0500)
This commit prevent from shrinking an mds node when max_mds wouldn't be
honored after that operation.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 2cfe5a04bfcb4aae6b7842621dfacab90bdcc7c3)

infrastructure-playbooks/shrink-mds.yml

index 470fcc8249592a2920e98c7b81611509abded6d3..c8e41ec3b0307e1f1a470cd9a2b2b043b98668b5 100644 (file)
       command: "{{ container_exec_cmd | default('') }} ceph tell mds.{{ mds_to_kill }} exit"
       delegate_to: "{{ groups[mon_group_name][0] }}"
 
+    - name: get ceph status
+      command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json"
+      register: ceph_status
+      delegate_to: "{{ groups[mon_group_name][0] }}"
+
+    - name: set_fact current_max_mds
+      set_fact:
+        current_max_mds: "{{ (ceph_status.stdout | from_json)['fsmap']['max'] }}"
+
+    - name: fail if removing that mds node wouldn't satisfy max_mds anymore
+      fail:
+        msg: "Can't remove more mds as it won't satisfy current max_mds setting"
+      when:
+        - ((((ceph_status.stdout | from_json)['fsmap']['up'] | int) + ((ceph_status.stdout | from_json)['fsmap']['up:standby'] | int)) - 1) < current_max_mds | int
+        - (ceph_status.stdout | from_json)['fsmap']['up'] | int > 1
+
     - name: stop mds service and verify it
       block:
         - name: stop mds service
 
     - name: fail if the mds is reported as active or standby
       block:
-        - name: get ceph status
+        - name: get new ceph status
           command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json"
           register: ceph_status
           delegate_to: "{{ groups[mon_group_name][0] }}"