]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
init-ceph, ceph-osd-prestart: set osd weight with more precision 4833/head
authorSage Weil <sage@redhat.com>
Tue, 2 Jun 2015 21:20:31 +0000 (14:20 -0700)
committerSage Weil <sage@redhat.com>
Tue, 2 Jun 2015 21:20:31 +0000 (14:20 -0700)
Our fixed point weights can go down to .0001 -- allow that.

Fixes: #11500
Signed-off-by: Sage Weil <sage@redhat.com>
src/ceph-osd-prestart.sh
src/init-ceph.in

index 77153c9b369171473dba19260c9db421e944e3cc..79f2c132d9fc9da0287ede429f7ef6f386c6769b 100644 (file)
@@ -27,7 +27,7 @@ if [ "${update:-1}" = "1" -o "${update:-1}" = "true" ]; then
     fi
     location="$($hook --cluster ${cluster:-ceph} --id $id --type osd)"
     weight="$(ceph-conf --cluster=${cluster:-ceph} --name=osd.$id --lookup osd_crush_initial_weight || :)"
-    defaultweight=`df -P -k /var/lib/ceph/osd/${cluster:-ceph}-$id/ | tail -1 | awk '{ d= $2/1073741824 ; r = sprintf("%.2f", d); print r }'`
+    defaultweight=`df -P -k /var/lib/ceph/osd/${cluster:-ceph}-$id/ | tail -1 | awk '{ d= $2/1073741824 ; r = sprintf("%.4f", d); print r }'`
     ceph \
         --cluster="${cluster:-ceph}" \
         --name="osd.$id" \
index 71e1b6a687274dd085e52685a33459c124c6ee8b..d676ac72f2cbccf97ddc1af83811671cd5f91a33 100644 (file)
@@ -365,7 +365,7 @@ for name in $what; do
                    get_conf osd_location_hook "$BINDIR/ceph-crush-location" "osd crush location hook"
                    osd_location=`$osd_location_hook --cluster $cluster --id $id --type osd`
                    get_conf osd_weight "" "osd crush initial weight"
-                   defaultweight="$(df -P -k $osd_data/. | tail -1 | awk '{ print sprintf("%.2f",$2/1073741824) }')"
+                   defaultweight="$(df -P -k $osd_data/. | tail -1 | awk '{ print sprintf("%.4f",$2/1073741824) }')"
                    get_conf osd_keyring "$osd_data/keyring" "keyring"
                    do_cmd_okfail "timeout 30 $BINDIR/ceph -c $conf --name=osd.$id --keyring=$osd_keyring osd crush create-or-move -- $id ${osd_weight:-${defaultweight:-1}} $osd_location"
                    if [ "$ERR" != "0" ]; then