]> git.proxmox.com Git - ceph.git/blob - ceph/qa/standalone/osd/osd-bench.sh
update sources to v12.1.2
[ceph.git] / ceph / qa / standalone / osd / osd-bench.sh
1 #!/bin/bash
2 #
3 # Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
4 # Copyright (C) 2014, 2015 Red Hat <contact@redhat.com>
5 #
6 # Author: Loic Dachary <loic@dachary.org>
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU Library Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
11 # any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU Library Public License for more details.
17 #
18
19 source $CEPH_ROOT/qa/standalone/ceph-helpers.sh
20
21 function run() {
22 local dir=$1
23 shift
24
25 export CEPH_MON="127.0.0.1:7106" # git grep '\<7106\>' : there must be only one
26 export CEPH_ARGS
27 CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none "
28 CEPH_ARGS+="--mon-host=$CEPH_MON "
29
30 local funcs=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
31 for func in $funcs ; do
32 setup $dir || return 1
33 $func $dir || return 1
34 teardown $dir || return 1
35 done
36 }
37
38 function TEST_bench() {
39 local dir=$1
40
41 run_mon $dir a || return 1
42 run_mgr $dir x || return 1
43 run_osd $dir 0 || return 1
44
45 local osd_bench_small_size_max_iops=$(CEPH_ARGS='' ceph-conf \
46 --show-config-value osd_bench_small_size_max_iops)
47 local osd_bench_large_size_max_throughput=$(CEPH_ARGS='' ceph-conf \
48 --show-config-value osd_bench_large_size_max_throughput)
49 local osd_bench_max_block_size=$(CEPH_ARGS='' ceph-conf \
50 --show-config-value osd_bench_max_block_size)
51 local osd_bench_duration=$(CEPH_ARGS='' ceph-conf \
52 --show-config-value osd_bench_duration)
53
54 #
55 # block size too high
56 #
57 expect_failure $dir osd_bench_max_block_size \
58 ceph tell osd.0 bench 1024 $((osd_bench_max_block_size + 1)) || return 1
59
60 #
61 # count too high for small (< 1MB) block sizes
62 #
63 local bsize=1024
64 local max_count=$(($bsize * $osd_bench_duration * $osd_bench_small_size_max_iops))
65 expect_failure $dir bench_small_size_max_iops \
66 ceph tell osd.0 bench $(($max_count + 1)) $bsize || return 1
67
68 #
69 # count too high for large (>= 1MB) block sizes
70 #
71 local bsize=$((1024 * 1024 + 1))
72 local max_count=$(($osd_bench_large_size_max_throughput * $osd_bench_duration))
73 expect_failure $dir osd_bench_large_size_max_throughput \
74 ceph tell osd.0 bench $(($max_count + 1)) $bsize || return 1
75
76 #
77 # default values should work
78 #
79 ceph tell osd.0 bench || return 1
80
81 #
82 # test object_size < block_size
83 ceph tell osd.0 bench 10 14456 4444 3
84 #
85
86 #
87 # test object_size < block_size & object_size = 0(default value)
88 #
89 ceph tell osd.0 bench 1 14456
90 }
91
92 main osd-bench "$@"
93
94 # Local Variables:
95 # compile-command: "cd ../.. ; make -j4 && test/osd/osd-bench.sh"
96 # End: