From 849d0b8ebb9aff4a2106c01a691112578f25281c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Tue, 18 Nov 2014 11:10:11 -0800 Subject: [PATCH] Fix the variable substitution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prior to that commit if ceph_version was equal to 0.80.5, the variable substitution ${ceph_version%.*} was returning 0.80 and not 0. Using ${ceph_version%%.*} returns the desired value. Also refactoring the version output to get a X.X format since only major and minor are important. Change-Id: Iab50f3c4b24a01a68acda417eae0501f00038f54 Signed-off-by: Sébastien Han --- lib/ceph | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ceph b/lib/ceph index 2ddf5dbb6a..bfad3dcf60 100644 --- a/lib/ceph +++ b/lib/ceph @@ -72,7 +72,7 @@ CEPH_REPLICAS_SEQ=$(seq ${CEPH_REPLICAS}) # ------------ function get_ceph_version { - local ceph_version_str=$(sudo ceph daemon mon.$(hostname) version | cut -d '"' -f 4) + local ceph_version_str=$(sudo ceph daemon mon.$(hostname) version | cut -d '"' -f 4 | cut -f 1,2 -d '.') echo $ceph_version_str } @@ -162,7 +162,7 @@ EOF # pools data and metadata were removed in the Giant release so depending on the version we apply different commands local ceph_version=$(get_ceph_version) # change pool replica size according to the CEPH_REPLICAS set by the user - if [[ ${ceph_version%.*} -eq 0 ]] && [[ ${ceph_version##*.} -lt 87 ]]; then + if [[ ${ceph_version%%.*} -eq 0 ]] && [[ ${ceph_version##*.} -lt 87 ]]; then sudo ceph -c ${CEPH_CONF_FILE} osd pool set rbd size ${CEPH_REPLICAS} sudo ceph -c ${CEPH_CONF_FILE} osd pool set data size ${CEPH_REPLICAS} sudo ceph -c ${CEPH_CONF_FILE} osd pool set metadata size ${CEPH_REPLICAS}