]> git.proxmox.com Git - ceph.git/blob - ceph/src/test/mon/run_test.sh
bump version to 12.1.1-pve1 while rebasing patches
[ceph.git] / ceph / src / test / mon / run_test.sh
1 #!/bin/bash
2 # vim: ts=8 sw=2 smarttab
3 #
4 # $0.sh - run mon workload generator
5
6 if [[ ! -e "./ceph_ver.h" ]]; then
7 echo "This script must be run from the repository's src/ directory"
8 exit 1
9 fi
10
11 usage() {
12 echo "usage: $1 [options..] <num-osds>"
13 echo
14 echo "options:"
15 echo " -v, --verbose Be more verbose"
16 echo " -c, --conf FILE ceph.conf location"
17 echo " -d, --duration SECS Run test for SECS seconds (default: 300)"
18 echo " --debug LEVEL Set the test's debug level (default: 0)"
19 echo " -n, --new Make a fresh run by creating a new cluster"
20 echo
21 echo "environment variables:"
22 echo " EXTRA_ARGS Pass additional ceph arguments to the test"
23 echo
24 }
25
26 stop_ceph() {
27 if [[ ! -e "init-ceph" ]]; then
28 echo "could not find 'init-ceph'; killing only by hand and may bob have"
29 echo "mercy on our souls"
30 else
31 ./init-ceph stop
32 fi
33
34 for i in mon osd mds; do
35 killall -9 ceph-$i
36 done
37 }
38
39 start_mon() {
40 if [[ ! -e "init-ceph" ]]; then
41 echo "could not find 'init-ceph'; attempting to start monitors by hand"
42
43 for i in a b c; do
44 ./ceph-mon -i $i -c ceph.conf -k keyring -d
45 done
46 else
47 ./init-ceph start mon
48 fi
49 }
50
51 make_fresh() {
52 rm -fr dev/ out/ keyring
53 mkdir dev
54
55 if [[ ! -e "vstart.sh" ]]; then
56 echo "could not find 'vstart.sh', which is weird; what have you done?"
57 exit 1
58 fi
59
60 env MON=3 OSD=0 MDS=0 MGR=0 \
61 ./vstart.sh -n -l -d mon
62 }
63
64 DEBUG=0
65 TEST_CEPH_CONF=
66 DURATION=
67 LOADGEN_NUM_OSDS=
68 ARGS=
69
70 [[ ! -z $EXTRA_ARGS ]] && ARGS="$EXTRA_ARGS"
71
72 fresh_run=0
73
74 while [[ $# -gt 0 ]];
75 do
76 case "$1" in
77 -v | --verbose)
78 VERBOSE=1
79 shift
80 ;;
81 -c | --conf)
82 if [[ "$2" == "" ]]; then
83 echo "'$1' expects an argument; none was given"
84 exit 1
85 fi
86 TEST_CEPH_CONF="$2"
87 shift 2
88 ;;
89 --debug)
90 if [[ -z $2 ]]; then
91 echo "'$1' expects an argument; none was given"
92 exit 1
93 fi
94 ARGS="$ARGS --debug-none $2"
95 shift 2
96 ;;
97 -d | --duration)
98 if [[ -z $2 ]]; then
99 echo "'$1' expects an argument; none was given"
100 exit 1
101 fi
102 DURATION=$2
103 shift 2
104 ;;
105 -n | --new)
106 fresh_run=1
107 shift
108 ;;
109 --)
110 shift
111 break
112 ;;
113 -*)
114 echo "$1: unknown option" >&2
115 usage $0
116 exit 1
117 ;;
118 *)
119 LOADGEN_NUM_OSDS=$1
120 shift
121 break
122 ;;
123 esac
124 done
125
126 if [[ -z $LOADGEN_NUM_OSDS ]]; then
127 echo "must specify the number of osds"
128 usage $0
129 exit 1
130 fi
131
132 stop_ceph ;
133 [[ $fresh_run -eq 1 ]] && make_fresh ;
134 start_mon ;
135
136 env VERBOSE=$VERBOSE TEST_CEPH_CONF="$TEST_CEPH_CONF" \
137 DURATION=$DURATION EXTRA_ARGS="$ARGS" \
138 LOADGEN_NUM_OSDS=$LOADGEN_NUM_OSDS \
139 PATH="$PATH:`pwd`" ../qa/workunits/mon/workloadgen.sh