From d43384df51f0685e533e4ccc347f09c8bb9b5852 Mon Sep 17 00:00:00 2001 From: Guilhem Lettron Date: Thu, 7 Mar 2013 15:32:13 +0100 Subject: [PATCH] Set weight of an osd based on df. priority to Weight in ceph.conf Signed-off-by: Guilhem Lettron --- src/upstart/ceph-osd.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/upstart/ceph-osd.conf b/src/upstart/ceph-osd.conf index ff05fdfc0066..7bf8d704e265 100644 --- a/src/upstart/ceph-osd.conf +++ b/src/upstart/ceph-osd.conf @@ -21,6 +21,7 @@ pre-start script # 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" \ @@ -28,7 +29,7 @@ pre-start script osd crush create-or-move \ -- \ "$id" \ - "${weight:-1}" \ + "${weight:-${defaultweight:-1}}" \ root=default \ host="$(hostname -s)" \ $location \ -- 2.47.3