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 $CEPH_ROOT/qa/standalone/ceph-helpers.sh
25 export CEPH_MON="127.0.0.1:7106" # git grep '\<7106\>' : there must be only one
27 CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none "
28 CEPH_ARGS+="--mon-host=$CEPH_MON "
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
38 function TEST_bench() {
41 run_mon $dir a || return 1
42 run_mgr $dir x || return 1
43 run_osd $dir 0 || return 1
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)
57 expect_failure $dir osd_bench_max_block_size \
58 ceph tell osd.0 bench 1024 $((osd_bench_max_block_size + 1)) || return 1
61 # count too high for small (< 1MB) block sizes
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
69 # count too high for large (>= 1MB) block sizes
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
77 # default values should work
79 ceph tell osd.0 bench || return 1
82 # test object_size < block_size
83 ceph tell osd.0 bench 10 14456 4444 3
87 # test object_size < block_size & object_size = 0(default value)
89 ceph tell osd.0 bench 1 14456
95 # compile-command: "cd ../.. ; make -j4 && test/osd/osd-bench.sh"