]> git.proxmox.com Git - ceph.git/blob - ceph/src/mstart.sh
import 15.2.0 Octopus source
[ceph.git] / ceph / src / mstart.sh
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
21 [ -z "$BUILD_DIR" ] && BUILD_DIR=build
22
23 if [ -e CMakeCache.txt ]; then
24 root_path=$PWD
25 elif [ -e $root_path/../${BUILD_DIR}/CMakeCache.txt ]; then
26 cd $root_path/../${BUILD_DIR}
27 root_path=$PWD
28 fi
29 RUN_ROOT_PATH=${root_path}/run
30
31 mkdir -p $RUN_ROOT_PATH
32
33 if [ -z "$CLUSTERS_LIST" ]
34 then
35 CLUSTERS_LIST=$RUN_ROOT_PATH/.clusters.list
36 fi
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 "$@"