From: Sage Weil Date: Tue, 29 Oct 2013 18:08:58 +0000 (-0700) Subject: upstart, sysvinit: use ceph-crush-location hook X-Git-Tag: v0.72-rc1~3^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F779%2Fhead;p=ceph.git upstart, sysvinit: use ceph-crush-location hook 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 --- diff --git a/src/init-ceph.in b/src/init-ceph.in index 1a80a42b03ec..7399abb8f858 100644 --- a/src/init-ceph.in +++ b/src/init-ceph.in @@ -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 diff --git a/src/upstart/ceph-osd.conf b/src/upstart/ceph-osd.conf index ab6af5835e0d..a2f659460da7 100644 --- a/src/upstart/ceph-osd.conf +++ b/src/upstart/ceph-osd.conf @@ -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