]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mkcephfs: use new default keyring locations
authorSage Weil <sage@inktank.com>
Wed, 8 Aug 2012 21:01:35 +0000 (14:01 -0700)
committerSage Weil <sage@inktank.com>
Wed, 8 Aug 2012 21:01:35 +0000 (14:01 -0700)
The ceph-conf command only parses the conf; it does not apply default
config values.  This breaks mkcephfs if values are not specified in the
config.

Let ceph-osd create its own key, fix copying, and fix creation/copying for
the mds.

Fixes: #2845
Reported-by: Florian Haas <florian@hastexo.com>
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
src/mkcephfs.in

index 17b6014474d37be9f8311e53f7db8496e4259943..77bc7db46ff73cb2fc5fb0b00d4361fed79779cf 100644 (file)
@@ -230,14 +230,6 @@ fi
 
 ### init-daemon ###
 
-create_private_key()
-{
-    get_conf keyring "$dir/keyring.$name" "keyring"
-    echo "creating private key for $name keyring $keyring"
-    $BINDIR/ceph-authtool --create-keyring --gen-key -n $name $keyring
-    $BINDIR/ceph-authtool -p -n $name $keyring > $dir/key.$name
-}
-
 if [ -n "$initdaemon" ]; then
     name=$initdaemon
     type=`echo $name | cut -c 1-3`   # e.g. 'mon', if $name is 'mon1'
@@ -257,12 +249,19 @@ if [ -n "$initdaemon" ]; then
     fi
 
     if [ $type = "osd" ]; then
-       $BINDIR/ceph-osd -c $conf --monmap $dir/monmap -i $id --mkfs
-       create_private_key
+       $BINDIR/ceph-osd -c $conf --monmap $dir/monmap -i $id --mkfs --mkkey
+
+       get_conf osd_data "/var/lib/ceph/osd/ceph-$id" "osd_data"
+       get_conf osd_keyring "$osd_data/keyring" "keyring"
+       $BINDIR/ceph-authtool -p -n $name $osd_keyring > $dir/key.$name
     fi
     
     if [ $type = "mds" ]; then
-       create_private_key
+       get_conf mds_data "/var/lib/ceph/mds/ceph-$id" "mds_data"
+       get_conf mds_keyring "$mds_data/keyring" "keyring"
+       echo "creating private key for $name keyring $mds_keyring"
+       $BINDIR/ceph-authtool --create-keyring --gen-key -n $name $mds_keyring
+       $BINDIR/ceph-authtool -p -n $name $mds_keyring > $dir/key.$name
     fi
 
     if [ $type = "mon" ]; then