Merge pull request #1969 from ceph/wip-vstart-conf

vstart.sh: echo CEPH_{CONF,KEYRING} exports if necessary

Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2014-06-25 10:48:06 -07:00
commit a7e1ad428f

View File

@ -18,7 +18,7 @@ set -e
[ -z "$CEPH_NUM_MDS" ] && CEPH_NUM_MDS=3
[ -z "$CEPH_NUM_RGW" ] && CEPH_NUM_RGW=1
[ -z "$CEPH_DIR" ] && CEPH_DIR="$PWD/"
[ -z "$CEPH_DIR" ] && CEPH_DIR="$PWD"
[ -z "$CEPH_DEV_DIR" ] && CEPH_DEV_DIR="$CEPH_DIR/dev"
[ -z "$CEPH_OUT_DIR" ] && CEPH_OUT_DIR="$CEPH_DIR/out"
[ -z "$CEPH_RGW_PORT" ] && CEPH_RGW_PORT=8000
@ -45,8 +45,7 @@ journal=1
MON_ADDR=""
conf="$CEPH_DIR/ceph.conf"
conf_fn="$CEPH_DIR/ceph.conf"
keyring_fn="$CEPH_DIR/keyring"
osdmap_fn="/tmp/ceph_osdmap.$$"
monmap_fn="/tmp/ceph_monmap.$$"
@ -190,7 +189,7 @@ if [ "$start_all" -eq 1 ]; then
start_osd=1
fi
ARGS="-c $conf"
ARGS="-c $conf_fn"
run() {
type=$1
@ -298,9 +297,9 @@ echo "ip $IP"
if [ "$cephx" -eq 1 ]; then
CEPH_ADM="$CEPH_BIN/ceph -c $conf -k $keyring_fn"
CEPH_ADM="$CEPH_BIN/ceph -c $conf_fn -k $keyring_fn"
else
CEPH_ADM="$CEPH_BIN/ceph -c $conf"
CEPH_ADM="$CEPH_BIN/ceph -c $conf_fn"
fi
MONS=""
@ -330,7 +329,7 @@ if [ "$start_mon" -eq 1 ]; then
if [ "$new" -eq 1 ]; then
if [ $overwrite_conf -eq 1 ]; then
cat <<EOF > $conf
cat <<EOF > $conf_fn
; generated by vstart.sh on `date`
[global]
fsid = $(uuidgen)
@ -343,11 +342,11 @@ if [ "$start_mon" -eq 1 ]; then
run dir = $CEPH_OUT_DIR
EOF
if [ "$cephx" -eq 1 ] ; then
cat <<EOF >> $conf
cat <<EOF >> $conf_fn
auth supported = cephx
EOF
else
cat <<EOF >> $conf
cat <<EOF >> $conf_fn
auth cluster required = none
auth service required = none
auth client required = none
@ -358,7 +357,7 @@ fi
else
journal_path=""
fi
cat <<EOF >> $conf
cat <<EOF >> $conf_fn
[client]
keyring = $keyring_fn
@ -420,7 +419,7 @@ EOF
do
str=$str" --add $f $IP:$(($CEPH_PORT+$count))"
if [ $overwrite_conf -eq 1 ]; then
cat <<EOF >> $conf
cat <<EOF >> $conf_fn
[mon.$f]
host = $HOSTNAME
mon data = $CEPH_DEV_DIR/mon.$f
@ -441,7 +440,7 @@ EOF
cmd="mkdir -p $CEPH_DEV_DIR/mon.$f"
echo $cmd
$cmd
cmd="$CEPH_BIN/ceph-mon --mkfs -c $conf -i $f --monmap=$monmap_fn"
cmd="$CEPH_BIN/ceph-mon --mkfs -c $conf_fn -i $f --monmap=$monmap_fn"
cmd="$cmd --keyring=$keyring_fn"
echo $cmd
$cmd
@ -465,7 +464,7 @@ if [ "$start_osd" -eq 1 ]; then
do
if [ "$new" -eq 1 ]; then
if [ $overwrite_conf -eq 1 ]; then
cat <<EOF >> $conf
cat <<EOF >> $conf_fn
[osd.$osd]
host = $HOSTNAME
EOF
@ -491,7 +490,7 @@ fi
# mds
if [ "$smallmds" -eq 1 ]; then
cat <<EOF >> $conf
cat <<EOF >> $conf_fn
[mds]
mds log max segments = 2
mds cache size = 10000
@ -506,13 +505,13 @@ if [ "$start_mds" -eq 1 -a "$CEPH_NUM_MDS" -gt 0 ]; then
mkdir -p $CEPH_DEV_DIR/mds.$name
key_fn=$CEPH_DEV_DIR/mds.$name/keyring
if [ $overwrite_conf -eq 1 ]; then
cat <<EOF >> $conf
cat <<EOF >> $conf_fn
[mds.$name]
host = $HOSTNAME
EOF
if [ "$standby" -eq 1 ]; then
mkdir -p $CEPH_DEV_DIR/mds.${name}s
cat <<EOF >> $conf
cat <<EOF >> $conf_fn
mds standby for rank = $mds
[mds.${name}s]
mds standby replay = true
@ -556,7 +555,7 @@ if [ "$start_rgw" -eq 1 ]; then
if [ "$new" -eq 1 ]; then
if [ $overwrite_conf -eq 1 ]; then
dnsname=`hostname -f`
cat <<EOF >> $conf
cat <<EOF >> $conf_fn
[client.radosgw.rgw$rgw]
host = $HOSTNAME
$DAEMONOPTS
@ -620,7 +619,7 @@ EOF
skey='h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q=='
echo access key $akey
echo secret key $skey
$CEPH_BIN/radosgw-admin user create --uid tester --access-key $akey --secret $skey --display-name 'M. Tester' --email tester@ceph.com -c $conf
$CEPH_BIN/radosgw-admin user create --uid tester --access-key $akey --secret $skey --display-name 'M. Tester' --email tester@ceph.com -c $conf_fn
fi
fi
echo start rgw$rgw on http://localhost:$rgwport
@ -629,8 +628,6 @@ EOF
done
fi
echo "started. stop.sh to stop. see out/* (e.g. 'tail -f out/????') for debug output."
if [ "$ec" -eq 1 ]; then
$SUDO $CEPH_ADM <<EOF
osd erasure-code-profile set ec-profile m=2 k=1
@ -672,7 +669,13 @@ EOF
}
do_hitsets $hitset
echo "started. stop.sh to stop. see out/* (e.g. 'tail -f out/????') for debug output."
echo ""
echo "export PYTHONPATH=./pybind"
echo "export LD_LIBRARY_PATH=.libs"
if [ "$CEPH_DIR" != "$PWD" ]; then
echo "export CEPH_CONF=$conf_fn"
echo "export CEPH_KEYRING=$keyring_fn"
fi