From 47ce52a5cfcc596dd3b482aa8c44c7c573d4e57a Mon Sep 17 00:00:00 2001 From: "Kabanov, Dmitrii" Date: Mon, 27 Jul 2020 10:44:04 -0700 Subject: [PATCH] [Ceph-client] Add check of target osd value The PS adds the check of target osd value. The expected amount of OSDs should be always more or equal to existing OSDs. If there is more OSDs than expected it means that the value is not correct. Change-Id: I117a189a18dbb740585b343db9ac9b596a34b929 --- ceph-client/templates/bin/pool/_init.sh.tpl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ceph-client/templates/bin/pool/_init.sh.tpl b/ceph-client/templates/bin/pool/_init.sh.tpl index 8d81d6602..d71469b60 100644 --- a/ceph-client/templates/bin/pool/_init.sh.tpl +++ b/ceph-client/templates/bin/pool/_init.sh.tpl @@ -67,6 +67,11 @@ function check_osd_count() { EXPECTED_OSDS={{.Values.conf.pool.target.osd}} REQUIRED_PERCENT_OF_OSDS={{.Values.conf.pool.target.required_percent_of_osds}} + if [ ${num_up_osds} -gt ${EXPECTED_OSDS} ]; then + echo "The expected amount of OSDs (${EXPECTED_OSDS}) is less than available OSDs (${num_up_osds}). Please, correct the value (.Values.conf.pool.target.osd)." + exit 1 + fi + MIN_OSDS=$(($EXPECTED_OSDS*$REQUIRED_PERCENT_OF_OSDS/100)) if [ ${MIN_OSDS} -lt 1 ]; then MIN_OSDS=1