]> git.proxmox.com Git - ceph.git/blob - ceph/src/test/osd/osd-config.sh
bump version to 12.1.1-pve1 while rebasing patches
[ceph.git] / ceph / src / test / osd / osd-config.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 $(dirname $0)/../detect-build-env-vars.sh
20 source $CEPH_ROOT/qa/workunits/ceph-helpers.sh
21
22 function run() {
23 local dir=$1
24 shift
25
26 export CEPH_MON="127.0.0.1:7100" # git grep '\<7100\>' : 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
39 function TEST_config_init() {
40 local dir=$1
41
42 run_mon $dir a || return 1
43 run_mgr $dir x || return 1
44 local advance=1000
45 local stale=1000
46 local cache=500
47 run_osd $dir 0 \
48 --osd-map-max-advance $advance \
49 --osd-map-cache-size $cache \
50 --osd-pg-epoch-persisted-max-stale $stale \
51 || return 1
52 CEPH_ARGS='' ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1
53 grep 'is not > osd_map_max_advance' $dir/osd.0.log || return 1
54 grep 'is not > osd_pg_epoch_persisted_max_stale' $dir/osd.0.log || return 1
55 }
56
57 function TEST_config_track() {
58 local dir=$1
59
60 run_mon $dir a || return 1
61 run_mgr $dir x || return 1
62 run_osd $dir 0 || return 1
63
64 local osd_map_cache_size=$(CEPH_ARGS='' ceph-conf \
65 --show-config-value osd_map_cache_size)
66 local osd_map_max_advance=$(CEPH_ARGS='' ceph-conf \
67 --show-config-value osd_map_max_advance)
68 local osd_pg_epoch_persisted_max_stale=$(CEPH_ARGS='' ceph-conf \
69 --show-config-value osd_pg_epoch_persisted_max_stale)
70 #
71 # lower cache_size under max_advance to trigger the warning
72 #
73 ! grep 'is not > osd_map_max_advance' $dir/osd.0.log || return 1
74 local cache=$(($osd_map_max_advance / 2))
75 ceph tell osd.0 injectargs "--osd-map-cache-size $cache" || return 1
76 CEPH_ARGS='' ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1
77 grep 'is not > osd_map_max_advance' $dir/osd.0.log || return 1
78 rm $dir/osd.0.log
79 CEPH_ARGS='' ceph --admin-daemon $dir/ceph-osd.0.asok log reopen || return 1
80
81 #
82 # reset cache_size to the default and assert that it does not trigger the warning
83 #
84 ! grep 'is not > osd_map_max_advance' $dir/osd.0.log || return 1
85 local cache=$osd_map_cache_size
86 ceph tell osd.0 injectargs "--osd-map-cache-size $cache" || return 1
87 CEPH_ARGS='' ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1
88 ! grep 'is not > osd_map_max_advance' $dir/osd.0.log || return 1
89 rm $dir/osd.0.log
90 CEPH_ARGS='' ceph --admin-daemon $dir/ceph-osd.0.asok log reopen || return 1
91
92 #
93 # increase the osd_map_max_advance above the default cache_size
94 #
95 ! grep 'is not > osd_map_max_advance' $dir/osd.0.log || return 1
96 local advance=$(($osd_map_cache_size * 2))
97 ceph tell osd.0 injectargs "--osd-map-max-advance $advance" || return 1
98 CEPH_ARGS='' ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1
99 grep 'is not > osd_map_max_advance' $dir/osd.0.log || return 1
100 rm $dir/osd.0.log
101 CEPH_ARGS='' ceph --admin-daemon $dir/ceph-osd.0.asok log reopen || return 1
102
103 #
104 # increase the osd_pg_epoch_persisted_max_stale above the default cache_size
105 #
106 ! grep 'is not > osd_pg_epoch_persisted_max_stale' $dir/osd.0.log || return 1
107 local stale=$(($osd_map_cache_size * 2))
108 ceph tell osd.0 injectargs "--osd-pg-epoch-persisted-max-stale $stale" || return 1
109 CEPH_ARGS='' ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1
110 grep 'is not > osd_pg_epoch_persisted_max_stale' $dir/osd.0.log || return 1
111 rm $dir/osd.0.log
112 CEPH_ARGS='' ceph --admin-daemon $dir/ceph-osd.0.asok log reopen || return 1
113 }
114
115 main osd-config "$@"
116
117 # Local Variables:
118 # compile-command: "cd ../.. ; make -j4 && test/osd/osd-config.sh"
119 # End: