install -d -m0755 /var/run/ceph
- # update location in crush
- # TODO: un-hardcode the domain=root assumption
- ceph \
- --cluster="${cluster:-ceph}" \
- --name="osd.$id" \
- --keyring="/var/lib/ceph/osd/${cluster:-ceph}-$id/keyring" \
- osd crush set \
- "$id" "osd.$id" 1 domain=root \
- || :
+ # 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 || :)"
+ if [ -n "$location" ]; then
+ 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 \
+ || :
+ fi
+
end script
instance ${cluster:-ceph}/$id