diff options
| author | rthallisey <rhallise@redhat.com> | 2015-08-19 12:37:27 -0400 |
|---|---|---|
| committer | Sam Yaple <sam@yaple.net> | 2015-08-30 07:54:01 +0000 |
| commit | 63a7d01639e9a48c20ae1ae368cfafad7ac6cd87 (patch) | |
| tree | e39a2dfc7261bad13cd25e48979dff848d35e49c /docker/ceph/ceph-osd | |
| parent | 2d4a261f2295f0db9b7fceee25c05fb5442773fa (diff) | |
| download | kolla-63a7d01639e9a48c20ae1ae368cfafad7ac6cd87.tar.gz kolla-63a7d01639e9a48c20ae1ae368cfafad7ac6cd87.zip | |
Ceph container
Running ceph in a container requires 2 pieces:
- ceph-mon
- objectstorage-daemon (osd)
Co-Authored-By: Sam Yaple <sam@yaple.net>
Change-Id: I33e5baf72e4bc493889da0d796041acfd1a2cad3
Partially-Implements: blueprint ceph-container
Diffstat (limited to 'docker/ceph/ceph-osd')
| -rw-r--r-- | docker/ceph/ceph-osd/Dockerfile.j2 | 7 | ||||
| -rw-r--r-- | docker/ceph/ceph-osd/config-external.sh | 10 | ||||
| -rw-r--r-- | docker/ceph/ceph-osd/start.sh | 35 |
3 files changed, 52 insertions, 0 deletions
diff --git a/docker/ceph/ceph-osd/Dockerfile.j2 b/docker/ceph/ceph-osd/Dockerfile.j2 new file mode 100644 index 000000000..e9d47fc70 --- /dev/null +++ b/docker/ceph/ceph-osd/Dockerfile.j2 @@ -0,0 +1,7 @@ +FROM {{ namespace }}/{{ base_distro }}-{{ install_type }}-ceph-base:{{ tag }} +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +COPY start.sh / +COPY config-external.sh /opt/kolla/ + +CMD ["/start.sh"] diff --git a/docker/ceph/ceph-osd/config-external.sh b/docker/ceph/ceph-osd/config-external.sh new file mode 100644 index 000000000..8e17487ed --- /dev/null +++ b/docker/ceph/ceph-osd/config-external.sh @@ -0,0 +1,10 @@ +#!/bin/bash +SOURCE="/opt/kolla/ceph-osd/ceph.conf" +TARGET="/etc/ceph/ceph.conf" +OWNER="ceph" + +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0644 $TARGET +fi diff --git a/docker/ceph/ceph-osd/start.sh b/docker/ceph/ceph-osd/start.sh new file mode 100644 index 000000000..cf9114a62 --- /dev/null +++ b/docker/ceph/ceph-osd/start.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -o errexit + +CMD="/usr/bin/ceph-osd" +ARGS="-f -d -i ${OSD_ID} --osd-journal ${OSD_DIR}/journal -k ${OSD_DIR}/keyring" + +# Loading common functions. +source /opt/kolla/kolla-common.sh + +# Execute config strategy +set_configs + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + # Creating a new label for the disk + parted "${OSD_DEV}" -s -- mklabel gpt + + # Preparing the OSD for use with Ceph + ceph-disk prepare "${OSD_DEV}" + OSD_ID="$(ceph osd create)" + OSD_DIR="/var/lib/ceph/osd/ceph-${OSD_ID}" + mkdir -p "${OSD_DIR}" + mount "${OSD_DEV}1" "${OSD_DIR}" + ceph-osd -i "${OSD_ID}" --mkfs --mkkey + ceph auth add "osd.${OSD_ID}" osd 'allow *' mon 'allow proflie osd' -i "${OSD_DIR}/keyring" + + # Adding osd to crush map + ceph osd crush add-bucket "$(hostname)" host + ceph osd crush move "$(hostname)" root=default + ceph osd crush add "${OSD_ID}" "${OSD_INITIAL_WEIGHT}" host="$(hostname)" + exit 0 +fi + +exec $CMD $ARGS |
