]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
upstart/ceph-osd: make crush update on start optional
authorSage Weil <sage@inktank.com>
Wed, 13 Feb 2013 21:58:49 +0000 (13:58 -0800)
committerSage Weil <sage@inktank.com>
Thu, 14 Feb 2013 06:18:59 +0000 (22:18 -0800)
By default, we will do some (minimal) CRUSH tree adjustment.  However,
we make this update optional.

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

index 23ca2eb2a23087e622fed4714ee9daf4ff59f62a..ff05fdfc0066f07fce990cd44ebc60cfe78a56af 100644 (file)
@@ -15,28 +15,31 @@ pre-start script
 
     install -d -m0755 /var/run/ceph
 
-    # 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 || :)"
-    weight="$(ceph-conf --cluster="$cluster" --name="osd.$id" --lookup osd_crush_initial_weight || :)"
-    ceph \
-        --cluster="${cluster:-ceph}" \
-        --name="osd.$id" \
-        --keyring="/var/lib/ceph/osd/${cluster:-ceph}-$id/keyring" \
-        osd crush create-or-move \
-       -- \
-        "$id" \
-       "${weight:-1}" \
-       root=default \
-       host="$(hostname -s)" \
-       $location \
-       || :
+    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 || :)"
+       weight="$(ceph-conf --cluster=${cluster:-ceph} --name=osd.$id --lookup osd_crush_initial_weight || :)"
+       ceph \
+            --cluster="${cluster:-ceph}" \
+            --name="osd.$id" \
+            --keyring="/var/lib/ceph/osd/${cluster:-ceph}-$id/keyring" \
+            osd crush create-or-move \
+           -- \
+            "$id" \
+           "${weight:-1}" \
+           root=default \
+           host="$(hostname -s)" \
+           $location \
+           || :
+    fi
 
     journal="/var/lib/ceph/osd/${cluster:-ceph}-$id/journal"
     if [ -L "$journal" -a ! -e "$journal" ]; then
-       echo "ceph-osd($UPSTART_INSTANCE): journal not present, not starting yet." 1>&2
-       stop
-       exit 0
+       echo "ceph-osd($UPSTART_INSTANCE): journal not present, not starting yet." 1>&2
+       stop
+       exit 0
     fi
 end script