From fd175ab9212f9078b50b7c3ebc407c5feba2d882 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sat, 30 Nov 2013 13:41:06 -0800 Subject: [PATCH] sysvinit, upstart: use df -P when weighting new OSDs This avoids parsing out the wrong value when a long device name makes df wrap over two lines. Fixes: #6699 Reported-by: Jan Harkes Reviewed-by: Noah Watkins Signed-off-by: Sage Weil --- src/init-ceph.in | 2 +- src/upstart/ceph-osd.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/init-ceph.in b/src/init-ceph.in index e00143084705..17cf05ccbe4a 100644 --- a/src/init-ceph.in +++ b/src/init-ceph.in @@ -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 \ diff --git a/src/upstart/ceph-osd.conf b/src/upstart/ceph-osd.conf index f91c67d8757e..7175c2d93008 100644 --- a/src/upstart/ceph-osd.conf +++ b/src/upstart/ceph-osd.conf @@ -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" \ -- 2.47.3