From 8d1c67beb254f8d0a94a959756b604d7fe18e785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Fri, 30 Nov 2018 11:20:03 +0100 Subject: [PATCH] osd: discover osd_objectstore on the fly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Applying and passing the OSD_BLUESTORE/FILESTORE on the fly is wrong for existing clusters as their config will be changed. Typically, if an OSD was prepared with ceph-disk on filestore and we change the default objectstore to bluestore, the activation will fail. The flag osd_objectstore should only be used for the preparation, not activation. The activate in this case detects the osd objecstore which prevents failures like the one described above. Signed-off-by: Sébastien Han (cherry picked from commit 4c5113019893c92c4d75c9fc457b04158b86398b) --- roles/ceph-osd/templates/ceph-osd-run.sh.j2 | 22 +++++++++------------ 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/roles/ceph-osd/templates/ceph-osd-run.sh.j2 b/roles/ceph-osd/templates/ceph-osd-run.sh.j2 index 3089a25e0..c0557ad4b 100644 --- a/roles/ceph-osd/templates/ceph-osd-run.sh.j2 +++ b/roles/ceph-osd/templates/ceph-osd-run.sh.j2 @@ -56,6 +56,13 @@ function expose_partitions { expose_partitions "$1" +# discover osd_objectstore for ceph-disk based osds +if [[ $DOCKER_ENV =~ "BLUESTORE" ]]; then + DOCKER_ENV="$DOCKER_ENV -e OSD_BLUESTORE=1" +elif [[ $DOCKER_ENV =~ "JOURNAL" ]]; then + DOCKER_ENV="$DOCKER_ENV -e OSD_FILESTORE=1" +fi + {% endif -%} @@ -93,22 +100,11 @@ expose_partitions "$1" -e KV_IP={{ kv_endpoint }} \ -e KV_PORT={{ kv_port }} \ {% endif -%} - {% if osd_objectstore == 'filestore' and not dmcrypt -%} - -e OSD_FILESTORE=1 \ - -e OSD_DMCRYPT=0 \ - {% endif -%} - {% if osd_objectstore == 'filestore' and dmcrypt -%} - -e OSD_FILESTORE=1 \ + {% if dmcrypt -%} -e OSD_DMCRYPT=1 \ - {% endif -%} - {% if osd_objectstore == 'bluestore' and not dmcrypt -%} - -e OSD_BLUESTORE=1 \ + {% else -%} -e OSD_DMCRYPT=0 \ {% endif -%} - {% if osd_objectstore == 'bluestore' and dmcrypt -%} - -e OSD_BLUESTORE=1 \ - -e OSD_DMCRYPT=1 \ - {% endif -%} -e CLUSTER={{ cluster }} \ {% if (ceph_tcmalloc_max_total_thread_cache | int) > 0 and osd_objectstore == 'filestore' -%} -e TCMALLOC_MAX_TOTAL_THREAD_CACHE_BYTES={{ ceph_tcmalloc_max_total_thread_cache }} \