]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
sysvinit, upstart: use df -P when weighting new OSDs 798/head 882/head
authorSage Weil <sage@inktank.com>
Sat, 30 Nov 2013 21:41:06 +0000 (13:41 -0800)
committerSage Weil <sage@inktank.com>
Sat, 30 Nov 2013 21:41:15 +0000 (13:41 -0800)
This avoids parsing out the wrong value when a long device name makes
df wrap over two lines.

Fixes: #6699
Reported-by: Jan Harkes <jaharkes@cs.cmu.edu>
Reviewed-by: Noah Watkins <noah.watkins@inktank.com>
Signed-off-by: Sage Weil <sage@inktank.com>
src/init-ceph.in
src/upstart/ceph-osd.conf

index e001430847059f92d1c0d307a7aa930b83ec24b3..17cf05ccbe4a6f28f0a2f27365b12e6a94c560de 100644 (file)
@@ -322,7 +322,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 ceph --id $id --type osd`
                    get_conf osd_weight "" "osd crush initial weight"
-                   defaultweight="$(do_cmd "df $osd_data/. | tail -1 | awk '{ d= \$2/1073741824 ; r = sprintf(\"%.2f\", d); print r }'")"
+                   defaultweight="$(do_cmd "df -P -k $osd_data/. | tail -1 | awk '{ d= \$2/1073741824 ; r = sprintf(\"%.2f\", d); print r }'")"
                    get_conf osd_keyring "$osd_data/keyring" "keyring"
                    do_cmd "timeout 10 $BINDIR/ceph \
                        --name=osd.$id \
index f91c67d8757ee1e1fc328ac9038cd802879b39c8..7175c2d93008cd51f8e49b4b8b9027336ce35318 100644 (file)
@@ -24,7 +24,7 @@ pre-start script
        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 /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("%.2f", d); print r }'`
        ceph \
             --cluster="${cluster:-ceph}" \
             --name="osd.$id" \