mstart.sh: run multiple clusters in a single source tree

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
This commit is contained in:
Yehuda Sadeh 2015-12-07 17:06:03 -08:00
parent 61392c1c2c
commit dfa403c733
2 changed files with 60 additions and 2 deletions

45
src/mstart.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/sh
usage="usage: $0 <name> [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 "$@"

View File

@ -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.$$"