From 90f77fb01579b1859199b451d090170d4752a3e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Fri, 31 Oct 2014 12:05:20 +0100 Subject: [PATCH] Fix DevStack Ceph on the Giant release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As of the Ceph Giant release, pools 'data' and 'metadata' (used for CephFS) were removed. Thus applying the pool change command fails on Giant since those pools don't exist anymore. Now we are checking for every release prior to Giant and apply proper commands accordingly. Change-Id: Ia12042899c0e6809f5b98c2e0de177bb61c8a790 Signed-off-by: Sébastien Han --- lib/ceph | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/ceph b/lib/ceph index e55738c0d2..2ddf5dbb6a 100644 --- a/lib/ceph +++ b/lib/ceph @@ -71,6 +71,11 @@ CEPH_REPLICAS_SEQ=$(seq ${CEPH_REPLICAS}) # Functions # ------------ +function get_ceph_version { + local ceph_version_str=$(sudo ceph daemon mon.$(hostname) version | cut -d '"' -f 4) + echo $ceph_version_str +} + # import_libvirt_secret_ceph() - Imports Cinder user key into libvirt # so it can connect to the Ceph cluster while attaching a Cinder block device function import_libvirt_secret_ceph { @@ -154,10 +159,16 @@ EOF sleep 5 done + # 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 - sudo ceph -c ${CEPH_CONF_FILE} osd pool set data size ${CEPH_REPLICAS} - sudo ceph -c ${CEPH_CONF_FILE} osd pool set rbd size ${CEPH_REPLICAS} - sudo ceph -c ${CEPH_CONF_FILE} osd pool set metadata size ${CEPH_REPLICAS} + 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} + else + sudo ceph -c ${CEPH_CONF_FILE} osd pool set rbd size ${CEPH_REPLICAS} + fi # create a simple rule to take OSDs instead of host with CRUSH # then apply this rules to the default pool