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:7100" # git grep '\<7100\>' : 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_config_init
() {
42 run_mon
$dir a ||
return 1
43 run_mgr
$dir x ||
return 1
48 --osd-map-max-advance $advance \
49 --osd-map-cache-size $cache \
50 --osd-pg-epoch-persisted-max-stale $stale \
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
57 function TEST_config_track
() {
60 run_mon
$dir a ||
return 1
61 run_mgr
$dir x ||
return 1
62 run_osd
$dir 0 ||
return 1
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
)
71 # lower cache_size under max_advance to trigger the warning
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
79 CEPH_ARGS
='' ceph
--admin-daemon $dir/ceph-osd
.0.asok log reopen ||
return 1
82 # reset cache_size to the default and assert that it does not trigger the warning
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
90 CEPH_ARGS
='' ceph
--admin-daemon $dir/ceph-osd
.0.asok log reopen ||
return 1
93 # increase the osd_map_max_advance above the default cache_size
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
101 CEPH_ARGS
='' ceph
--admin-daemon $dir/ceph-osd
.0.asok log reopen ||
return 1
104 # increase the osd_pg_epoch_persisted_max_stale above the default cache_size
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
112 CEPH_ARGS
='' ceph
--admin-daemon $dir/ceph-osd
.0.asok log reopen ||
return 1
118 # compile-command: "cd ../.. ; make -j4 && test/osd/osd-config.sh"