From 6767d0ad4817117cab8eff723eb17a57c50facad Mon Sep 17 00:00:00 2001 From: Chinasubbareddy Mallavarapu Date: Tue, 4 Jun 2019 14:39:00 -0500 Subject: [PATCH] [ceph-client] Handle pool min_size during ceph cluster expansion This is to update logic for pool min_size parameter as this is not getting changed when replication changes from intilization. Change-Id: I30f99aaf92c3dc83afce10534b1d2ac9402b7fa7 --- ceph-client/templates/bin/pool/_init.sh.tpl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ceph-client/templates/bin/pool/_init.sh.tpl b/ceph-client/templates/bin/pool/_init.sh.tpl index 9e4b7ff25..031ef1376 100644 --- a/ceph-client/templates/bin/pool/_init.sh.tpl +++ b/ceph-client/templates/bin/pool/_init.sh.tpl @@ -80,11 +80,17 @@ function create_pool () { ceph --cluster "${CLUSTER}" osd pool set "${POOL_NAME}" size ${POOL_REPLICATION} ceph --cluster "${CLUSTER}" osd pool set "${POOL_NAME}" crush_rule "${POOL_CRUSH_RULE}" for PG_PARAM in pg_num pgp_num; do - CURRENT_PG_VALUE=$(ceph --cluster ceph osd pool get "${POOL_NAME}" "${PG_PARAM}" | awk "/^${PG_PARAM}:/ { print \$NF }") + CURRENT_PG_VALUE=$(ceph --cluster "${CLUSTER}" osd pool get "${POOL_NAME}" "${PG_PARAM}" | awk "/^${PG_PARAM}:/ { print \$NF }") if [ "${POOL_PLACEMENT_GROUPS}" -gt "${CURRENT_PG_VALUE}" ]; then - ceph --cluster ceph osd pool set "${POOL_NAME}" "${PG_PARAM}" "${POOL_PLACEMENT_GROUPS}" + ceph --cluster "${CLUSTER}" osd pool set "${POOL_NAME}" "${PG_PARAM}" "${POOL_PLACEMENT_GROUPS}" fi done + +#This is to handle cluster expansion case where replication may change from intilization + if [ ${POOL_REPLICATION} -gt 1 ]; then + EXPECTED_POOLMINSIZE=$[${POOL_REPLICATION}-1] + ceph --cluster "${CLUSTER}" osd pool set "${POOL_NAME}" min_size ${EXPECTED_POOLMINSIZE} + fi # # Handling of .Values.conf.pool.target.protected: # Possible settings