Browse code

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>

Sébastien Han authored on 2014/10/31 20:05:20
Showing 1 changed files
... ...
@@ -71,6 +71,11 @@ CEPH_REPLICAS_SEQ=$(seq ${CEPH_REPLICAS})
71 71
 # Functions
72 72
 # ------------
73 73
 
74
+function get_ceph_version {
75
+    local ceph_version_str=$(sudo ceph daemon mon.$(hostname) version | cut -d '"' -f 4)
76
+    echo $ceph_version_str
77
+}
78
+
74 79
 # import_libvirt_secret_ceph() - Imports Cinder user key into libvirt
75 80
 # so it can connect to the Ceph cluster while attaching a Cinder block device
76 81
 function import_libvirt_secret_ceph {
... ...
@@ -154,10 +159,16 @@ EOF
154 154
         sleep 5
155 155
     done
156 156
 
157
+    # pools data and metadata were removed in the Giant release so depending on the version we apply different commands
158
+    local ceph_version=$(get_ceph_version)
157 159
     # change pool replica size according to the CEPH_REPLICAS set by the user
158
-    sudo ceph -c ${CEPH_CONF_FILE} osd pool set data size ${CEPH_REPLICAS}
159
-    sudo ceph -c ${CEPH_CONF_FILE} osd pool set rbd size ${CEPH_REPLICAS}
160
-    sudo ceph -c ${CEPH_CONF_FILE} osd pool set metadata size ${CEPH_REPLICAS}
160
+    if [[ ${ceph_version%.*} -eq 0 ]] && [[ ${ceph_version##*.} -lt 87 ]]; then
161
+        sudo ceph -c ${CEPH_CONF_FILE} osd pool set rbd size ${CEPH_REPLICAS}
162
+        sudo ceph -c ${CEPH_CONF_FILE} osd pool set data size ${CEPH_REPLICAS}
163
+        sudo ceph -c ${CEPH_CONF_FILE} osd pool set metadata size ${CEPH_REPLICAS}
164
+    else
165
+        sudo ceph -c ${CEPH_CONF_FILE} osd pool set rbd size ${CEPH_REPLICAS}
166
+    fi
161 167
 
162 168
     # create a simple rule to take OSDs instead of host with CRUSH
163 169
     # then apply this rules to the default pool