]> git.proxmox.com Git - ceph.git/blob - ceph/src/script/run-cbt.sh
import quincy beta 17.1.0
[ceph.git] / ceph / src / script / run-cbt.sh
1 #!/bin/sh
2
3 usage() {
4 prog_name=$1
5 shift
6 cat <<EOF
7 usage:
8 $prog_name [options] <config-file>...
9
10 options:
11 -a,--archive-dir directory in which the test result is stored, default to $PWD/cbt-archive
12 --build-dir directory where CMakeCache.txt is located, default to $PWD
13 --cbt directory of cbt if you have already a copy of it. ceph/cbt:master will be cloned from github if not specified
14 -h,--help print this help message
15 --source-dir the path to the top level of Ceph source tree, default to $PWD/..
16 --use-existing do not setup/teardown a vstart cluster for testing
17
18 example:
19 $prog_name --cbt ~/dev/cbt -a /tmp ../src/test/crimson/cbt/radosbench_4K_read.yaml
20 EOF
21 }
22
23 prog_name=$(basename $0)
24 archive_dir=$PWD/cbt-archive
25 build_dir=$PWD
26 source_dir=$(dirname $PWD)
27 use_existing=false
28 classical=false
29 opts=$(getopt --options "a:h" --longoptions "archive-dir:,build-dir:,source-dir:,cbt:,help,use-existing,classical" --name $prog_name -- "$@")
30 eval set -- "$opts"
31
32 while true; do
33 case "$1" in
34 -a|--archive-dir)
35 archive_dir=$2
36 shift 2
37 ;;
38 --build-dir)
39 build_dir=$2
40 shift 2
41 ;;
42 --source-dir)
43 source_dir=$2
44 shift 2
45 ;;
46 --cbt)
47 cbt_dir=$2
48 shift 2
49 ;;
50 --use-existing)
51 use_existing=true
52 shift
53 ;;
54 --classical)
55 classical=true
56 shift
57 ;;
58 -h|--help)
59 usage $prog_name
60 return 0
61 ;;
62 --)
63 shift
64 break
65 ;;
66 *)
67 echo "unexpected argument $1" 1>&2
68 return 1
69 ;;
70 esac
71 done
72
73 if test $# -gt 0; then
74 config_files="$@"
75 else
76 echo "$prog_name: please specify one or more .yaml files" 1>&2
77 usage $prog_name
78 return 1
79 fi
80
81 if test -z "$cbt_dir"; then
82 cbt_dir=$PWD/cbt
83 git clone --depth 1 -b master https://github.com/ceph/cbt.git $cbt_dir
84 fi
85
86 # store absolute path before changing cwd
87 source_dir=$(readlink -f $source_dir)
88 if ! $use_existing; then
89 cd $build_dir || exit
90 # seastar uses 128*8 aio in reactor for io and 10003 aio for events pooling
91 # for each core, if it fails to enough aio context, the seastar application
92 # bails out. and take other process into consideration, let's make it
93 # 32768 per core
94 max_io=$(expr 32768 \* "$(nproc)")
95 if test "$(/sbin/sysctl --values fs.aio-max-nr)" -lt $max_io; then
96 sudo /sbin/sysctl -q -w fs.aio-max-nr=$max_io
97 fi
98 if $classical; then
99 MDS=0 MGR=1 OSD=3 MON=1 $source_dir/src/vstart.sh -n -X \
100 --without-dashboard
101 else
102 MDS=0 MGR=1 OSD=3 MON=1 $source_dir/src/vstart.sh -n -X \
103 --without-dashboard --cyanstore \
104 -o "memstore_device_bytes=34359738368" \
105 --crimson --nodaemon --redirect-output \
106 --osd-args "--memory 4G"
107 fi
108 cd - || exit
109 fi
110
111 # i need to read the performance events,
112 # see https://www.kernel.org/doc/Documentation/sysctl/kernel.txt
113 if /sbin/capsh --supports=cap_sys_admin; then
114 perf_event_paranoid=$(/sbin/sysctl --values kernel.perf_event_paranoid)
115 if test $perf_event_paranoid -gt 0; then
116 sudo /sbin/sysctl -q -w kernel.perf_event_paranoid=0
117 fi
118 else
119 echo "without cap_sys_admin, $(whoami) cannot read the perf events"
120 fi
121
122 for config_file in $config_files; do
123 echo "testing $config_file"
124 cbt_config=$(mktemp $config_file.XXXX.yaml)
125 python3 $source_dir/src/test/crimson/cbt/t2c.py \
126 --build-dir $build_dir \
127 --input $config_file \
128 --output $cbt_config
129 python3 $cbt_dir/cbt.py \
130 --archive $archive_dir \
131 --conf $build_dir/ceph.conf \
132 $cbt_config
133 rm -f $cbt_config
134 done
135
136 if test -n "$perf_event_paranoid"; then
137 # restore the setting
138 sudo /sbin/sysctl -q -w kernel.perf_event_paranoid=$perf_event_paranoid
139 fi
140
141 if ! $use_existing; then
142 cd $build_dir || exit
143 if $classical; then
144 $source_dir/src/stop.sh
145 else
146 $source_dir/src/stop.sh --crimson
147 fi
148 fi