38 lines
1.0 KiB
Plaintext
38 lines
1.0 KiB
Plaintext
description "Ceph OSD"
|
|
|
|
start on ceph-osd
|
|
stop on runlevel [!2345]
|
|
|
|
respawn
|
|
respawn limit 5 30
|
|
|
|
pre-start script
|
|
set -e
|
|
test -x /usr/bin/ceph-osd || { stop; exit 0; }
|
|
test -d "/var/lib/ceph/osd/${cluster:-ceph}-$id" || { stop; exit 0; }
|
|
|
|
install -d -m0755 /var/run/ceph
|
|
|
|
# update location in crush; put in some suitable defaults on the
|
|
# command line, ceph.conf can override what it wants
|
|
location="$(ceph-conf --cluster="${cluster:-ceph}" --name="osd.$id" --lookup osd_crush_location || :)"
|
|
weight="$(ceph-conf --cluster="$cluster" --name="osd.$id" --lookup osd_crush_weight || :)"
|
|
ceph \
|
|
--cluster="${cluster:-ceph}" \
|
|
--name="osd.$id" \
|
|
--keyring="/var/lib/ceph/osd/${cluster:-ceph}-$id/keyring" \
|
|
osd crush set \
|
|
-- \
|
|
"$id" "osd.$id" "${weight:-1}" \
|
|
pool=default \
|
|
host="$(hostname -s)" \
|
|
$location \
|
|
|| :
|
|
end script
|
|
|
|
instance ${cluster:-ceph}/$id
|
|
export cluster
|
|
export id
|
|
|
|
exec /usr/bin/ceph-osd --cluster="${cluster:-ceph}" -i "$id" -f
|