diff --git a/src/mstart.sh b/src/mstart.sh new file mode 100755 index 00000000000..b67c1806ad7 --- /dev/null +++ b/src/mstart.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +usage="usage: $0 [vstart options]..\n" + +usage_exit() { + printf "$usage" + exit +} + +[ $# -lt 1 ] && usage_exit + + +instance=$1 +shift + +root_path=`dirname $0` +root_path=`(cd $root_path; pwd)` +RUN_ROOT_PATH=${root_path}/run +CLUSTERS_LIST=$RUN_ROOT_PATH/.clusters.list + +mkdir -p $RUN_ROOT_PATH + + +if [ ! -f $CLUSTERS_LIST ]; then +touch $CLUSTERS_LIST +fi + +pos=`grep -n -w $instance $CLUSTERS_LIST` +if [ $? -ne 0 ]; then + echo $instance >> $CLUSTERS_LIST + pos=`grep -n -w $instance $CLUSTERS_LIST` +fi + +pos=`echo $pos | cut -d: -f1` +base_port=$((6800+pos*10)) + +export VSTART_DEST=$RUN_ROOT_PATH/$instance +export CEPH_PORT=$base_port + +mkdir -p $VSTART_DEST + +echo "Cluster dest path: $VSTART_DEST" +echo "monitors base port: $CEPH_PORT" + +$root_path/vstart.sh "$@" diff --git a/src/vstart.sh b/src/vstart.sh index 8a5b52c0505..eef8f02db07 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -3,6 +3,18 @@ # abort on failure set -e +if [ -n "$VSTART_DEST" ]; then + SRC_PATH=`dirname $0` + SRC_PATH=`(cd $SRC_PATH; pwd)` + + CEPH_DIR=$SRC_PATH + CEPH_BIN=$SRC_PATH + CEPH_LIB=$SRC_PATH/.libs + CEPH_CONF_PATH=$VSTART_DEST + CEPH_DEV_DIR=$VSTART_DEST/dev + CEPH_OUT_DIR=$VSTART_DEST/out +fi + if [ -e CMakeCache.txt ]; then # Out of tree build, learn source location from CMakeCache.txt SRC_ROOT=`grep Ceph_SOURCE_DIR CMakeCache.txt | cut -d "=" -f 2` @@ -59,6 +71,7 @@ export DYLD_LIBRARY_PATH=$CEPH_LIB:$DYLD_LIBRARY_PATH [ -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 +[ -z "$CEPH_CONF_PATH" ] && CEPH_CONF_PATH=$CEPH_DIR extra_conf="" new=0 @@ -83,8 +96,8 @@ journal=1 MON_ADDR="" -conf_fn="$CEPH_DIR/ceph.conf" -keyring_fn="$CEPH_DIR/keyring" +conf_fn="$CEPH_CONF_PATH/ceph.conf" +keyring_fn="$CEPH_CONF_PATH/keyring" osdmap_fn="/tmp/ceph_osdmap.$$" monmap_fn="/tmp/ceph_monmap.$$"