diff --git a/ceph-osd/Chart.yaml b/ceph-osd/Chart.yaml index f4282deb2..cf8380944 100644 --- a/ceph-osd/Chart.yaml +++ b/ceph-osd/Chart.yaml @@ -15,6 +15,6 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Ceph OSD name: ceph-osd -version: 0.1.35 +version: 0.1.36 home: https://github.com/ceph/ceph ... diff --git a/ceph-osd/templates/bin/osd/_stop.sh.tpl b/ceph-osd/templates/bin/osd/_stop.sh.tpl index 7084bacb1..6309c1e17 100644 --- a/ceph-osd/templates/bin/osd/_stop.sh.tpl +++ b/ceph-osd/templates/bin/osd/_stop.sh.tpl @@ -16,6 +16,8 @@ limitations under the License. set -ex +source /tmp/utils-resolveLocations.sh + if [ "x${STORAGE_TYPE%-*}" == "xblock" ]; then OSD_DEVICE=$(readlink -f ${STORAGE_LOCATION}) OSD_JOURNAL=$(readlink -f ${JOURNAL_LOCATION}) diff --git a/ceph-osd/templates/bin/osd/ceph-volume/_common.sh.tpl b/ceph-osd/templates/bin/osd/ceph-volume/_common.sh.tpl index e09ce866e..283259448 100644 --- a/ceph-osd/templates/bin/osd/ceph-volume/_common.sh.tpl +++ b/ceph-osd/templates/bin/osd/ceph-volume/_common.sh.tpl @@ -20,6 +20,8 @@ export lock_fd='' export ALREADY_LOCKED=0 export PS4='+${BASH_SOURCE:+$(basename ${BASH_SOURCE}):${LINENO}:}${FUNCNAME:+${FUNCNAME}():} ' +source /tmp/utils-resolveLocations.sh + : "${CRUSH_LOCATION:=root=default host=${HOSTNAME}}" : "${OSD_PATH_BASE:=/var/lib/ceph/osd/${CLUSTER}}" : "${CEPH_CONF:="/etc/ceph/${CLUSTER}.conf"}" diff --git a/ceph-osd/templates/bin/utils/_defragOSDs.sh.tpl b/ceph-osd/templates/bin/utils/_defragOSDs.sh.tpl index 901b74095..18920a0ff 100644 --- a/ceph-osd/templates/bin/utils/_defragOSDs.sh.tpl +++ b/ceph-osd/templates/bin/utils/_defragOSDs.sh.tpl @@ -16,6 +16,8 @@ limitations under the License. set -ex +source /tmp/utils-resolveLocations.sh + if [ "x${STORAGE_TYPE%-*}" == "xblock" ]; then OSD_DEVICE=$(readlink -f ${STORAGE_LOCATION}) ODEV=$(echo ${OSD_DEVICE} | sed 's/[0-9]//g' | cut -f 3 -d '/') diff --git a/ceph-osd/templates/bin/utils/_resolveLocations.sh.tpl b/ceph-osd/templates/bin/utils/_resolveLocations.sh.tpl new file mode 100644 index 000000000..f36afa2d1 --- /dev/null +++ b/ceph-osd/templates/bin/utils/_resolveLocations.sh.tpl @@ -0,0 +1,41 @@ +#!/bin/bash + +{{/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +set -ex + +if [[ "${STORAGE_LOCATION}" ]]; then + STORAGE_LOCATION=$(ls ${STORAGE_LOCATION}) + if [[ `echo "${STORAGE_LOCATION}" | wc -w` -ge 2 ]]; then + echo "ERROR- Multiple locations found: ${STORAGE_LOCATION}" + exit 1 + fi +fi + +if [[ "${BLOCK_DB}" ]]; then + BLOCK_DB=$(ls ${BLOCK_DB}) + if [[ `echo "${BLOCK_DB}" | wc -w` -ge 2 ]]; then + echo "ERROR- Multiple locations found: ${BLOCK_DB}" + exit 1 + fi +fi + +if [[ "${BLOCK_WAL}" ]]; then + BLOCK_WAL=$(ls ${BLOCK_WAL}) + if [[ `echo "${BLOCK_WAL}" | wc -w` -ge 2 ]]; then + echo "ERROR- Multiple locations found: ${BLOCK_WAL}" + exit 1 + fi +fi diff --git a/ceph-osd/templates/configmap-bin.yaml b/ceph-osd/templates/configmap-bin.yaml index d897c625d..7c2f2a680 100644 --- a/ceph-osd/templates/configmap-bin.yaml +++ b/ceph-osd/templates/configmap-bin.yaml @@ -64,4 +64,6 @@ data: {{ tuple "bin/utils/_checkDNS.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} utils-defragOSDs.sh: | {{ tuple "bin/utils/_defragOSDs.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} + utils-resolveLocations.sh: | +{{ tuple "bin/utils/_resolveLocations.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} {{- end }} diff --git a/ceph-osd/templates/daemonset-osd.yaml b/ceph-osd/templates/daemonset-osd.yaml index cdce081b9..522f9e60f 100644 --- a/ceph-osd/templates/daemonset-osd.yaml +++ b/ceph-osd/templates/daemonset-osd.yaml @@ -240,6 +240,10 @@ spec: mountPath: /tmp/osd-common-ceph-volume.sh subPath: osd-common-ceph-volume.sh readOnly: true + - name: ceph-osd-bin + mountPath: /tmp/utils-resolveLocations.sh + subPath: utils-resolveLocations.sh + readOnly: true - name: ceph-osd-etc mountPath: /etc/ceph/ceph.conf.template subPath: ceph.conf @@ -403,6 +407,10 @@ spec: mountPath: /tmp/osd-common-ceph-volume.sh subPath: osd-common-ceph-volume.sh readOnly: true + - name: ceph-osd-bin + mountPath: /tmp/utils-resolveLocations.sh + subPath: utils-resolveLocations.sh + readOnly: true - name: ceph-osd-bin mountPath: /tmp/utils-defragOSDs.sh subPath: utils-defragOSDs.sh diff --git a/releasenotes/notes/ceph-osd.yaml b/releasenotes/notes/ceph-osd.yaml index ee494574e..10af48c58 100644 --- a/releasenotes/notes/ceph-osd.yaml +++ b/releasenotes/notes/ceph-osd.yaml @@ -36,4 +36,5 @@ ceph-osd: - 0.1.33 Update log-runner container for MAC - 0.1.34 Remove wait for misplaced objects during OSD restarts - 0.1.35 Consolidate mon_endpoints discovery + - 0.1.36 Add OSD device location pre-check ...