From: Sage Weil Date: Fri, 3 May 2013 00:18:27 +0000 (-0700) Subject: init-ceph: update osd crush map position on start X-Git-Tag: v0.61~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c189d855e67baadf977d8ca14509dcacd579af7a;p=ceph.git init-ceph: update osd crush map position on start This is what the upstart ceph-osd.conf does; we need to do the same so that new OSDs (e.g., that ceph-deploy creates) get added to the crush map. Signed-off-by: Sage Weil --- diff --git a/src/init-ceph.in b/src/init-ceph.in index 3e0b0810dd54..57ae19b11e1b 100644 --- a/src/init-ceph.in +++ b/src/init-ceph.in @@ -302,6 +302,30 @@ for name in $what; do do_root_cmd "modprobe $fs_type ; egrep -q '^[^ ]+ $fs_path' /proc/mounts || mount -t $fs_type $fs_opt $first_dev $fs_path" fi fi + + 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" + get_conf osd_weight "" "osd crush initial weight" + defaultweight=`df /var/lib/ceph/osd/ceph-$id/ | tail -1 | awk '{ d= $2/1073741824 ; r = sprintf("%.2f", d); print r }'` + get_conf osd_keyring "/var/lib/ceph/osd/ceph-$id/keyring" "keyring" + $BINDIR/ceph \ + --name="osd.$id" \ + --keyring="$osd_keyring" \ + osd crush create-or-move \ + -- \ + "$id" \ + "${osd_weight:-${defaultweight:-1}}" \ + root=default \ + host="$(hostname -s)" \ + $osd_location \ + || : + fi + fi + echo Starting Ceph $name on $host... mkdir -p $RUN_DIR get_conf pre_start_eval "" "pre start eval"