From f45e972330f950d45d4bcb323d168a9beb0edf04 Mon Sep 17 00:00:00 2001 From: John Spray Date: Tue, 22 Nov 2016 13:58:58 +0000 Subject: [PATCH] vstart: cleaner multi-mds startup with standbys The daemons will get assigned to roles in the order they start otherwise. The trick is to let them all go into the FSMap first and then increase max_mds. Signed-off-by: John Spray --- src/vstart.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/vstart.sh b/src/vstart.sh index c8730b0b91ba..d09df84ed5b4 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -709,10 +709,6 @@ if [ "$start_mds" -eq 1 -a "$CEPH_NUM_MDS" -gt 0 ]; then ceph_adm osd pool create "cephfs_data_${name}" 8 ceph_adm osd pool create "cephfs_metadata_${name}" 8 ceph_adm fs new "cephfs_${name}" "cephfs_metadata_${name}" "cephfs_data_${name}" - if [ "$CEPH_MAX_MDS" -gt 1 ]; then - ceph_adm fs set "cephfs_${name}" allow_multimds true --yes-i-really-mean-it - ceph_adm fs set "cephfs_${name}" max_mds "$CEPH_MAX_MDS" - fi fs=$(($fs + 1)) [ $fs -eq $CEPH_NUM_FS ] && break done @@ -761,6 +757,22 @@ EOF done fi +# Don't set max_mds until all the daemons are started, otherwise +# the intended standbys might end up in active roles. +if [ "$CEPH_MAX_MDS" -gt 1 ]; then + sleep 5 # wait for daemons to make it into FSMap before increasing max_mds +fi +fs=0 +for name in a b c d e f g h i j k l m n o p +do + if [ "$CEPH_MAX_MDS" -gt 1 ]; then + ceph_adm fs set "cephfs_${name}" allow_multimds true --yes-i-really-mean-it + ceph_adm fs set "cephfs_${name}" max_mds "$CEPH_MAX_MDS" + fi + fs=$(($fs + 1)) + [ $fs -eq $CEPH_NUM_FS ] && break +done + if [ "$CEPH_NUM_MGR" -gt 0 ]; then mgr=0 for name in x y z a b c d e f g h i j k l m n o p -- 2.47.3