From bfd26e7f78667ea4a5353becd53d2329d55bdac3 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Fri, 3 Jan 2020 15:56:43 +0100 Subject: [PATCH] shrink-mds: ensure max_mds is always honored This commit prevent from shrinking an mds node when max_mds wouldn't be honored after that operation. Signed-off-by: Guillaume Abrioux (cherry picked from commit 2cfe5a04bfcb4aae6b7842621dfacab90bdcc7c3) --- infrastructure-playbooks/shrink-mds.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/infrastructure-playbooks/shrink-mds.yml b/infrastructure-playbooks/shrink-mds.yml index 470fcc824..c8e41ec3b 100644 --- a/infrastructure-playbooks/shrink-mds.yml +++ b/infrastructure-playbooks/shrink-mds.yml @@ -82,6 +82,22 @@ 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 @@ -102,7 +118,7 @@ - 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] }}" -- 2.39.5