3 # Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
4 # Copyright (C) 2014, 2015 Red Hat <contact@redhat.com>
6 # Author: Loic Dachary <loic@dachary.org>
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)
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.
19 source $
(dirname $0)/..
/detect-build-env-vars.sh
20 source $CEPH_ROOT/qa
/workunits
/ceph-helpers.sh
26 export CEPH_MON
="127.0.0.1:7106" # git grep '\<7106\>' : there must be only one
28 CEPH_ARGS
+="--fsid=$(uuidgen) --auth-supported=none "
29 CEPH_ARGS
+="--mon-host=$CEPH_MON "
31 local funcs
=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
32 for func
in $funcs ; do
33 setup
$dir ||
return 1
34 $func $dir ||
return 1
35 teardown
$dir ||
return 1
39 function TEST_bench
() {
42 run_mon
$dir a ||
return 1
43 run_mgr
$dir x ||
return 1
44 run_osd
$dir 0 ||
return 1
46 local osd_bench_small_size_max_iops
=$
(CEPH_ARGS
='' ceph-conf \
47 --show-config-value osd_bench_small_size_max_iops
)
48 local osd_bench_large_size_max_throughput
=$
(CEPH_ARGS
='' ceph-conf \
49 --show-config-value osd_bench_large_size_max_throughput
)
50 local osd_bench_max_block_size
=$
(CEPH_ARGS
='' ceph-conf \
51 --show-config-value osd_bench_max_block_size
)
52 local osd_bench_duration
=$
(CEPH_ARGS
='' ceph-conf \
53 --show-config-value osd_bench_duration
)
58 expect_failure
$dir osd_bench_max_block_size \
59 ceph tell osd
.0 bench
1024 $
((osd_bench_max_block_size
+ 1)) ||
return 1
62 # count too high for small (< 1MB) block sizes
65 local max_count
=$
(($bsize * $osd_bench_duration * $osd_bench_small_size_max_iops))
66 expect_failure
$dir bench_small_size_max_iops \
67 ceph tell osd
.0 bench $
(($max_count + 1)) $bsize ||
return 1
70 # count too high for large (>= 1MB) block sizes
72 local bsize
=$
((1024 * 1024 + 1))
73 local max_count
=$
(($osd_bench_large_size_max_throughput * $osd_bench_duration))
74 expect_failure
$dir osd_bench_large_size_max_throughput \
75 ceph tell osd
.0 bench $
(($max_count + 1)) $bsize ||
return 1
78 # default values should work
80 ceph tell osd
.0 bench ||
return 1
83 # test object_size < block_size
84 ceph tell osd
.0 bench
10 14456 4444 3
88 # test object_size < block_size & object_size = 0(default value)
90 ceph tell osd
.0 bench
1 14456
96 # compile-command: "cd ../.. ; make -j4 && test/osd/osd-bench.sh"