]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
init-ceph: update osd crush map position on start
authorSage Weil <sage@inktank.com>
Fri, 3 May 2013 00:18:27 +0000 (17:18 -0700)
committerSage Weil <sage@inktank.com>
Fri, 3 May 2013 18:33:20 +0000 (11:33 -0700)
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 <sage@inktank.com>
src/init-ceph.in

index 3e0b0810dd54c932b343713e36a7a4cd1a6d7e54..57ae19b11e1bb22f9aa5795206e6dd5ceee688a1 100644 (file)
@@ -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"