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:7100" # git grep '\<7100\>' : 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_config_init
() {
41 run_mon
$dir a ||
return 1
42 run_mgr
$dir x ||
return 1
47 --osd-map-max-advance $advance \
48 --osd-map-cache-size $cache \
49 --osd-pg-epoch-persisted-max-stale $stale \
51 CEPH_ARGS
='' ceph
--admin-daemon $
(get_asok_path osd
.0) log flush ||
return 1
52 grep 'is not > osd_map_max_advance' $dir/osd
.0.log ||
return 1
53 grep 'is not > osd_pg_epoch_persisted_max_stale' $dir/osd
.0.log ||
return 1
56 function TEST_config_track
() {
59 run_mon
$dir a ||
return 1
60 run_mgr
$dir x ||
return 1
61 run_osd
$dir 0 ||
return 1
63 local osd_map_cache_size
=$
(CEPH_ARGS
='' ceph-conf \
64 --show-config-value osd_map_cache_size
)
65 local osd_map_max_advance
=$
(CEPH_ARGS
='' ceph-conf \
66 --show-config-value osd_map_max_advance
)
67 local osd_pg_epoch_persisted_max_stale
=$
(CEPH_ARGS
='' ceph-conf \
68 --show-config-value osd_pg_epoch_persisted_max_stale
)
70 # lower cache_size under max_advance to trigger the warning
72 ! grep 'is not > osd_map_max_advance' $dir/osd
.0.log ||
return 1
73 local cache
=$
(($osd_map_max_advance / 2))
74 ceph tell osd
.0 injectargs
"--osd-map-cache-size $cache" ||
return 1
75 CEPH_ARGS
='' ceph
--admin-daemon $
(get_asok_path osd
.0) log flush ||
return 1
76 grep 'is not > osd_map_max_advance' $dir/osd
.0.log ||
return 1
78 CEPH_ARGS
='' ceph
--admin-daemon $
(get_asok_path osd
.0) log reopen ||
return 1
81 # reset cache_size to the default and assert that it does not trigger the warning
83 ! grep 'is not > osd_map_max_advance' $dir/osd
.0.log ||
return 1
84 local cache
=$osd_map_cache_size
85 ceph tell osd
.0 injectargs
"--osd-map-cache-size $cache" ||
return 1
86 CEPH_ARGS
='' ceph
--admin-daemon $
(get_asok_path osd
.0) log flush ||
return 1
87 ! grep 'is not > osd_map_max_advance' $dir/osd
.0.log ||
return 1
89 CEPH_ARGS
='' ceph
--admin-daemon $
(get_asok_path osd
.0) log reopen ||
return 1
92 # increase the osd_map_max_advance above the default cache_size
94 ! grep 'is not > osd_map_max_advance' $dir/osd
.0.log ||
return 1
95 local advance
=$
(($osd_map_cache_size * 2))
96 ceph tell osd
.0 injectargs
"--osd-map-max-advance $advance" ||
return 1
97 CEPH_ARGS
='' ceph
--admin-daemon $
(get_asok_path osd
.0) log flush ||
return 1
98 grep 'is not > osd_map_max_advance' $dir/osd
.0.log ||
return 1
100 CEPH_ARGS
='' ceph
--admin-daemon $
(get_asok_path osd
.0) log reopen ||
return 1
103 # increase the osd_pg_epoch_persisted_max_stale above the default cache_size
105 ! grep 'is not > osd_pg_epoch_persisted_max_stale' $dir/osd
.0.log ||
return 1
106 local stale
=$
(($osd_map_cache_size * 2))
107 ceph tell osd
.0 injectargs
"--osd-pg-epoch-persisted-max-stale $stale" ||
return 1
108 CEPH_ARGS
='' ceph
--admin-daemon $
(get_asok_path osd
.0) log flush ||
return 1
109 grep 'is not > osd_pg_epoch_persisted_max_stale' $dir/osd
.0.log ||
return 1
111 CEPH_ARGS
='' ceph
--admin-daemon $
(get_asok_path osd
.0) log reopen ||
return 1
117 # compile-command: "cd ../.. ; make -j4 && test/osd/osd-config.sh"