Fix DevStack Ceph on the Giant release

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 <sebastien.han@enovance.com>
This commit is contained in:
Sébastien Han 2014-10-31 12:05:20 +01:00
parent bd5263cd37
commit 90f77fb015

View File

@ -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