]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/bin/sh |
2 | ||
3 | usage="usage: $0 <name> [vstart options]..\n" | |
4 | ||
5 | usage_exit() { | |
6 | printf "$usage" | |
7 | exit | |
8 | } | |
9 | ||
10 | [ $# -lt 1 ] && usage_exit | |
11 | ||
12 | ||
13 | instance=$1 | |
14 | shift | |
15 | ||
16 | vstart_path=`dirname $0` | |
17 | ||
18 | root_path=`dirname $0` | |
19 | root_path=`(cd $root_path; pwd)` | |
20 | ||
9f95a23c TL |
21 | [ -z "$BUILD_DIR" ] && BUILD_DIR=build |
22 | ||
7c673cae FG |
23 | if [ -e CMakeCache.txt ]; then |
24 | root_path=$PWD | |
9f95a23c TL |
25 | elif [ -e $root_path/../${BUILD_DIR}/CMakeCache.txt ]; then |
26 | cd $root_path/../${BUILD_DIR} | |
7c673cae FG |
27 | root_path=$PWD |
28 | fi | |
29 | RUN_ROOT_PATH=${root_path}/run | |
7c673cae FG |
30 | |
31 | mkdir -p $RUN_ROOT_PATH | |
32 | ||
11fdf7f2 TL |
33 | if [ -z "$CLUSTERS_LIST" ] |
34 | then | |
35 | CLUSTERS_LIST=$RUN_ROOT_PATH/.clusters.list | |
36 | fi | |
7c673cae FG |
37 | |
38 | if [ ! -f $CLUSTERS_LIST ]; then | |
39 | touch $CLUSTERS_LIST | |
40 | fi | |
41 | ||
42 | pos=`grep -n -w $instance $CLUSTERS_LIST` | |
43 | if [ $? -ne 0 ]; then | |
44 | echo $instance >> $CLUSTERS_LIST | |
45 | pos=`grep -n -w $instance $CLUSTERS_LIST` | |
46 | fi | |
47 | ||
48 | pos=`echo $pos | cut -d: -f1` | |
49 | base_port=$((6800+pos*20)) | |
50 | rgw_port=$((8000+pos*1)) | |
51 | ||
52 | export VSTART_DEST=$RUN_ROOT_PATH/$instance | |
53 | export CEPH_PORT=$base_port | |
54 | export CEPH_RGW_PORT=$rgw_port | |
55 | ||
56 | mkdir -p $VSTART_DEST | |
57 | ||
58 | echo "Cluster dest path: $VSTART_DEST" | |
59 | echo "monitors base port: $CEPH_PORT" | |
60 | echo "rgw base port: $CEPH_RGW_PORT" | |
61 | ||
62 | $vstart_path/vstart.sh "$@" |