]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
upstart, sysvinit: use ceph-crush-location hook
authorSage Weil <sage@inktank.com>
Tue, 29 Oct 2013 18:08:58 +0000 (11:08 -0700)
committerSage Weil <sage@inktank.com>
Tue, 29 Oct 2013 21:00:03 +0000 (14:00 -0700)
Instead of hard-coding a check in ceph.conf and some reasonable
defaults, defer this work to ceph-crush-location, and allow users to
specify their own hook with alternative logic.

This can be helpful in a nubmer of cases, like:

 - rack (or other) information included in hostname and easily parsed
   out by a hook
 - multiple types of devices in each host, resulting in 'parallel'
   crush trees (e.g., one for hdd, one for ssd)

Signed-off-by: Sage Weil <sage@inktank.com>
src/init-ceph.in
src/upstart/ceph-osd.conf

index 1a80a42b03ec9a14df3669940998e1199002bace..7399abb8f85855f2248c4afb22bf94f2e2f080a2 100644 (file)
@@ -318,9 +318,9 @@ for name in $what; do
            if [ "$type" = "osd" ]; then
                get_conf update_crush "" "osd crush update on start"
                if [ "${update_crush:-1}" = "1" -o "{$update_crush:-1}" = "true" ]; then
-                   # update location in crush; put in some suitable defaults on the
-                    # command line, ceph.conf can override what it wants
-                   get_conf osd_location "" "osd crush location"
+                   # update location in crush
+                   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 }'")"
                    get_conf osd_keyring "$osd_data/keyring" "keyring"
@@ -331,8 +331,6 @@ for name in $what; do
                        -- \
                        $id \
                        ${osd_weight:-${defaultweight:-1}} \
-                       root=default \
-                       host=$host \
                        $osd_location"
                fi
            fi
index ab6af5835e0ddbeb0ba76925e24ae1bc18e5ab52..a2f659460da78c72f9161775e7814198e8e173ec 100644 (file)
@@ -17,9 +17,9 @@ pre-start script
 
     update="$(ceph-conf --cluster=${cluster:-ceph} --name=osd.$id --lookup osd_crush_update_on_start || :)"
     if [ "${update:-1}" = "1" -o "{$update:-1}" = "true" ]; then
-        # update location in crush; put in some suitable defaults on the
-        # command line, ceph.conf can override what it wants
-       location="$(ceph-conf --cluster=${cluster:-ceph} --name=osd.$id --lookup osd_crush_location || :)"
+        # update location in crush
+       hook="$(ceph-conf --cluster=${cluster:-ceph} --name=osd.$id --lookup osd_crush_location_hook || :)"
+       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 }'`
        ceph \
@@ -30,8 +30,6 @@ pre-start script
            -- \
             "$id" \
            "${weight:-${defaultweight:-1}}" \
-           root=default \
-           host="$(hostname -s)" \
            $location
     fi