]> git.proxmox.com Git - ceph.git/blame - ceph/src/test/osd/osd-bench.sh
bump version to 12.1.1-pve1 while rebasing patches
[ceph.git] / ceph / src / test / osd / osd-bench.sh
CommitLineData
7c673cae
FG
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
19source $(dirname $0)/../detect-build-env-vars.sh
20source $CEPH_ROOT/qa/workunits/ceph-helpers.sh
21
22function run() {
23 local dir=$1
24 shift
25
26 export CEPH_MON="127.0.0.1:7106" # git grep '\<7106\>' : there must be only one
27 export CEPH_ARGS
28 CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none "
29 CEPH_ARGS+="--mon-host=$CEPH_MON "
30
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
36 done
37}
38
39function TEST_bench() {
40 local dir=$1
41
42 run_mon $dir a || return 1
43 run_mgr $dir x || return 1
44 run_osd $dir 0 || return 1
45
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)
54
55 #
56 # block size too high
57 #
58 expect_failure $dir osd_bench_max_block_size \
59 ceph tell osd.0 bench 1024 $((osd_bench_max_block_size + 1)) || return 1
60
61 #
62 # count too high for small (< 1MB) block sizes
63 #
64 local bsize=1024
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
68
69 #
70 # count too high for large (>= 1MB) block sizes
71 #
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
76
77 #
78 # default values should work
79 #
80 ceph tell osd.0 bench || return 1
81
82 #
83 # test object_size < block_size
84 ceph tell osd.0 bench 10 14456 4444 3
85 #
86
87 #
88 # test object_size < block_size & object_size = 0(default value)
89 #
90 ceph tell osd.0 bench 1 14456
91}
92
93main osd-bench "$@"
94
95# Local Variables:
96# compile-command: "cd ../.. ; make -j4 && test/osd/osd-bench.sh"
97# End: