]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Set weight of an osd based on df. 91/head
authorGuilhem Lettron <guilhem@lettron.fr>
Thu, 7 Mar 2013 14:32:13 +0000 (15:32 +0100)
committerGuilhem Lettron <guilhem@lettron.fr>
Thu, 7 Mar 2013 14:32:13 +0000 (15:32 +0100)
priority to Weight in ceph.conf

Signed-off-by: Guilhem Lettron <guilhem.lettron@youscribe.com>
src/upstart/ceph-osd.conf

index ff05fdfc0066f07fce990cd44ebc60cfe78a56af..7bf8d704e2658effeb4fcbcfb4c382bdb97fac66 100644 (file)
@@ -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 \