upstart: Use "ceph osd crush create-or-move".

Now the weight is only set when adding the OSD to the CRUSH map for
the first time. Once it's there, it's only moved, and the weight is
left untouched.

Change the ceph.conf option for the initial weight from
osd_crush_weight to osd_crush_initial_weight, to reflect this.

If you don't want new OSDs to store data automatically (to minimize
balancing and keep a human in the control loop), you can now
set osd_crush_initial_weight=0.

Closes: #3101
Signed-off-by: Tommi Virtanen <tv@inktank.com>
This commit is contained in:
Tommi Virtanen 2012-09-11 10:07:04 -07:00
parent 331bbcfbc0
commit fb6c5c3e9a

View File

@ -15,14 +15,15 @@ pre-start script
# 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 || :)"
weight="$(ceph-conf --cluster="$cluster" --name="osd.$id" --lookup osd_crush_initial_weight || :)"
ceph \
--cluster="${cluster:-ceph}" \
--name="osd.$id" \
--keyring="/var/lib/ceph/osd/${cluster:-ceph}-$id/keyring" \
osd crush set \
osd crush create-or-move \
-- \
"$id" "osd.$id" "${weight:-1}" \
"$id" \
"${weight:-1}" \
root=default \
host="$(hostname -s)" \
$location \