priority to Weight in ceph.conf
Signed-off-by: Guilhem Lettron <guilhem.lettron@youscribe.com>
# 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:-ceph} --name=osd.$id --lookup osd_crush_initial_weight || :)"
+ defaultweight=`df /var/lib/ceph/osd/${cluster:-ceph}-$id/ | tail -1 | awk '{ d= $2/1073741824 ; r = sprintf("%.2f", d); print r }'`
ceph \
--cluster="${cluster:-ceph}" \
--name="osd.$id" \
osd crush create-or-move \
-- \
"$id" \
- "${weight:-1}" \
+ "${weight:-${defaultweight:-1}}" \
root=default \
host="$(hostname -s)" \
$location \