summaryrefslogtreecommitdiff
path: root/docker/ceph
diff options
context:
space:
mode:
authorwangwei <wangwei@navercorp.com>2019-03-26 15:49:18 +0900
committerwangwei <wang.wei@navercorp.com>2019-04-19 07:22:22 +0000
commit8371ecb2acc5be214dcf9503c83a9ccb4081f151 (patch)
treeeb085bdd7c0be2f8dcd1f34980526aed72338d26 /docker/ceph
parentf958a9d36871c724a091f8ad4c0591a8769127eb (diff)
downloadkolla-8371ecb2acc5be214dcf9503c83a9ccb4081f151.tar.gz
kolla-8371ecb2acc5be214dcf9503c83a9ccb4081f151.zip
Fix the problem that the crush map is changed
When deploying ceph osd with kolla, each osd deployment will move the host bucket to default in the crush map. If we adjust the crush map, we have to re-adjust the crush map after adding osd or fixing osd. This commit fixes this problem. Change-Id: Ifdc3a1fd5fe37da529b2aee9811b12f744cff3bf Closes-bug: #1821681 (cherry picked from commit 3d4a7360a7c51a1f1c806a70026a7c8b20e20789)
Diffstat (limited to 'docker/ceph')
-rw-r--r--docker/ceph/ceph-osd/extend_start.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/docker/ceph/ceph-osd/extend_start.sh b/docker/ceph/ceph-osd/extend_start.sh
index e73e4d95f..68c0a28d6 100644
--- a/docker/ceph/ceph-osd/extend_start.sh
+++ b/docker/ceph/ceph-osd/extend_start.sh
@@ -149,8 +149,12 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
# These commands only need to be run once per host but are safe to run
# repeatedly. This can be improved later or if any problems arise.
- ceph osd crush add-bucket "${HOSTNAME}${CEPH_ROOT_NAME:+-${CEPH_ROOT_NAME}}" host
- ceph osd crush move "${HOSTNAME}${CEPH_ROOT_NAME:+-${CEPH_ROOT_NAME}}" root=${CEPH_ROOT_NAME:-default}
+ host_bucket_name="${HOSTNAME}${CEPH_ROOT_NAME:+-${CEPH_ROOT_NAME}}"
+ host_bucket_check=$(ceph osd tree | awk '/'"${host_bucket_name}"'/{print $0}' | wc -l)
+ if [[ "${host_bucket_check}" -eq 0 ]]; then
+ ceph osd crush add-bucket "${host_bucket_name}" host
+ ceph osd crush move "${host_bucket_name}" root=${CEPH_ROOT_NAME:-default}
+ fi
# Adding osd to crush map
ceph osd crush add "${OSD_ID}" "${OSD_INITIAL_WEIGHT}" host="${HOSTNAME}${CEPH_ROOT_NAME:+-${CEPH_ROOT_NAME}}"