]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
sysvinit: fix osd weight calculation on remote hosts 316/head
authorSage Weil <sage@inktank.com>
Wed, 22 May 2013 16:47:29 +0000 (09:47 -0700)
committerSage Weil <sage@inktank.com>
Wed, 22 May 2013 19:39:11 +0000 (12:39 -0700)
We need to do df on the remote host, not locally.

Simlarly, the ceph command uses the osd key, which exists remotely; run it there.

Signed-off-by: Sage Weil <sage@inktank.com>
src/init-ceph.in

index 65e93974283d2582d38a068756ecfb2c71a8de69..88fe6eb7d367257e212fc9d7c9a5130c8f33051b 100644 (file)
@@ -310,19 +310,20 @@ for name in $what; do
                     # 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 $osd_data/. | tail -1 | awk '{ d= $2/1073741824 ; r = sprintf("%.2f", d); print r }'`
+                   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"
-                   $BINDIR/ceph \
-                       --name="osd.$id" \
-                       --keyring="$osd_keyring" \
+                   do_cmd "$BINDIR/ceph \
+                       --name=osd.$id \
+                       --keyring=$osd_keyring \
                        osd crush create-or-move \
                        -- \
-                       "$id" \
-                       "${osd_weight:-${defaultweight:-1}}" \
+                       $id \
+                       ${osd_weight:-${defaultweight:-1}} \
                        root=default \
-                       host="$host" \
+                       host=$host \
                        $osd_location \
-                       || :
+                       || :"
                fi
            fi