From b69f393b549ed839440478a25d3416deb68e9866 Mon Sep 17 00:00:00 2001 From: Chinasubbareddy Mallavarapu Date: Tue, 25 Jun 2019 10:54:11 -0500 Subject: [PATCH] Ceph-Client: Wait for inactive pgs in ceph cluster This is to add wait logic for inactive pgs after adjusting pgs in manage pool job. Change-Id: I3353262644ae649ed9f495ac83a2567d9da263ae --- ceph-client/templates/bin/pool/_init.sh.tpl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ceph-client/templates/bin/pool/_init.sh.tpl b/ceph-client/templates/bin/pool/_init.sh.tpl index 746b2746ff..b40cb1159c 100644 --- a/ceph-client/templates/bin/pool/_init.sh.tpl +++ b/ceph-client/templates/bin/pool/_init.sh.tpl @@ -31,6 +31,16 @@ if [[ ! -e ${ADMIN_KEYRING} ]]; then exit 1 fi +function wait_for_inactive_pgs () { + echo "#### Start: Checking for inactive pgs ####" + + # Loop until all pgs are active + while [[ `ceph --cluster ${CLUSTER} pg ls | tail -n +2 | grep -v "active+"` ]] + do + sleep 3 + done +} + function create_crushrule () { CRUSH_NAME=$1 CRUSH_RULE=$2 @@ -151,3 +161,5 @@ manage_pool {{ .application }} {{ .name }} {{ .replication }} {{ .percent_total_ {{- if .Values.conf.pool.crush.tunables }} ceph --cluster "${CLUSTER}" osd crush tunables {{ .Values.conf.pool.crush.tunables }} {{- end }} + +wait_for_inactive_pgs