]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
upstart: Read crush location and weight from ceph.conf.
authorTommi Virtanen <tv@inktank.com>
Mon, 11 Jun 2012 22:27:02 +0000 (15:27 -0700)
committerTommi Virtanen <tv@inktank.com>
Mon, 11 Jun 2012 22:27:02 +0000 (15:27 -0700)
This introduces two new config variables, osd_crush_location
and osd_crush_weight. Not currently included in config_opts.h,
as these are not used in the C++ code.

Signed-off-by: Tommi Virtanen <tv@inktank.com>
src/upstart/ceph-osd.conf

index 1b4c950bea15fa6c3448949383aa8656da590e65..ac902857e2262061efee1f070a1e2a85ffe9b3d7 100644 (file)
@@ -12,15 +12,24 @@ pre-start script
 
     install -d -m0755 /var/run/ceph
 
-    # update location in crush
-    # TODO: un-hardcode the domain=root assumption
-    ceph \
-      --cluster="${cluster:-ceph}" \
-      --name="osd.$id" \
-      --keyring="/var/lib/ceph/osd/${cluster:-ceph}-$id/keyring" \
-      osd crush set \
-      "$id" "osd.$id" 1 domain=root \
-      || :
+    # 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 || :)"
+    if [ -n "$location" ]; then
+      weight="$(ceph-conf --cluster="$cluster" --name="osd.$id" --lookup osd_crush_weight || :)"
+      ceph \
+        --cluster="${cluster:-ceph}" \
+        --name="osd.$id" \
+        --keyring="/var/lib/ceph/osd/${cluster:-ceph}-$id/keyring" \
+        osd crush set \
+       -- \
+        "$id" "osd.$id" "${weight:-1}" \
+       pool=default \
+       host="$(hostname -s)" \
+       $location \
+       || :
+    fi
+
 end script
 
 instance ${cluster:-ceph}/$id