blob: cf9114a62e16abea11a7e4653043ff768746c631 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
|