]> git.proxmox.com Git - ceph.git/blob - ceph/src/test/erasure-code/test-erasure-code-plugins.sh
update sources to v12.1.1
[ceph.git] / ceph / src / test / erasure-code / test-erasure-code-plugins.sh
1 #!/bin/bash -x
2
3 source $(dirname $0)/../detect-build-env-vars.sh
4 source $CEPH_ROOT/qa/workunits/ceph-helpers.sh
5
6 arch=$(uname -m)
7
8 case $arch in
9 i[[3456]]86*|x86_64*|amd64*)
10 legacy_jerasure_plugins=(jerasure_generic jerasure_sse3 jerasure_sse4)
11 legacy_shec_plugins=(shec_generic shec_sse3 shec_sse4)
12 plugins=(jerasure shec lrc isa)
13 ;;
14 aarch64*|arm*)
15 legacy_jerasure_plugins=(jerasure_generic jerasure_neon)
16 legacy_shec_plugins=(shec_generic shec_neon)
17 plugins=(jerasure shec lrc)
18 ;;
19 *)
20 echo "unsupported platform ${arch}."
21 return 1
22 ;;
23 esac
24
25 function run() {
26 local dir=$1
27 shift
28
29 export CEPH_MON="127.0.0.1:17110" # git grep '\<17110\>' : there must be only one
30 export CEPH_ARGS
31 CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none "
32 CEPH_ARGS+="--mon-host=$CEPH_MON "
33
34 local funcs=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
35 for func in $funcs ; do
36 $func $dir || return 1
37 done
38 }
39
40 function TEST_preload_warning() {
41 local dir=$1
42
43 for plugin in ${legacy_jerasure_plugins[*]} ${legacy_shec_plugins[*]}; do
44 setup $dir || return 1
45 run_mon $dir a --osd_erasure_code_plugins="${plugin}" || return 1
46 run_mgr $dir x || return 1
47 CEPH_ARGS='' ceph --admin-daemon $dir/ceph-mon.a.asok log flush || return 1
48 run_osd $dir 0 --osd_erasure_code_plugins="${plugin}" || return 1
49 CEPH_ARGS='' ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1
50 grep "WARNING: osd_erasure_code_plugins contains plugin ${plugin}" $dir/mon.a.log || return 1
51 grep "WARNING: osd_erasure_code_plugins contains plugin ${plugin}" $dir/osd.0.log || return 1
52 teardown $dir || return 1
53 done
54 return 0
55 }
56
57 function TEST_preload_no_warning() {
58 local dir=$1
59
60 for plugin in ${plugins[*]}; do
61 setup $dir || return 1
62 run_mon $dir a --osd_erasure_code_plugins="${plugin}" || return 1
63 run_mgr $dir x || return 1
64 CEPH_ARGS='' ceph --admin-daemon $dir/ceph-mon.a.asok log flush || return 1
65 run_osd $dir 0 --osd_erasure_code_plugins="${plugin}" || return 1
66 CEPH_ARGS='' ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1
67 ! grep "WARNING: osd_erasure_code_plugins contains plugin" $dir/mon.a.log || return 1
68 ! grep "WARNING: osd_erasure_code_plugins contains plugin" $dir/osd.0.log || return 1
69 teardown $dir || return 1
70 done
71
72 return 0
73 }
74
75 function TEST_preload_no_warning_default() {
76 local dir=$1
77
78 setup $dir || return 1
79 run_mon $dir a || return 1
80 CEPH_ARGS='' ceph --admin-daemon $dir/ceph-mon.a.asok log flush || return 1
81 run_mgr $dir x || return 1
82 run_osd $dir 0 || return 1
83 CEPH_ARGS='' ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1
84 ! grep "WARNING: osd_erasure_code_plugins" $dir/mon.a.log || return 1
85 ! grep "WARNING: osd_erasure_code_plugins" $dir/osd.0.log || return 1
86 teardown $dir || return 1
87
88 return 0
89 }
90
91 function TEST_ec_profile_warning() {
92 local dir=$1
93
94 setup $dir || return 1
95 run_mon $dir a || return 1
96 run_mgr $dir x || return 1
97 for id in $(seq 0 2) ; do
98 run_osd $dir $id || return 1
99 done
100 wait_for_clean || return 1
101
102 for plugin in ${legacy_jerasure_plugins[*]}; do
103 ceph osd erasure-code-profile set prof-${plugin} crush-failure-domain=osd technique=reed_sol_van plugin=${plugin} || return 1
104 CEPH_ARGS='' ceph --admin-daemon $dir/ceph-mon.a.asok log flush || return 1
105 grep "WARNING: erasure coding profile prof-${plugin} uses plugin ${plugin}" $dir/mon.a.log || return 1
106 done
107
108 for plugin in ${legacy_shec_plugins[*]}; do
109 ceph osd erasure-code-profile set prof-${plugin} crush-failure-domain=osd plugin=${plugin} || return 1
110 CEPH_ARGS='' ceph --admin-daemon $dir/ceph-mon.a.asok log flush || return 1
111 grep "WARNING: erasure coding profile prof-${plugin} uses plugin ${plugin}" $dir/mon.a.log || return 1
112 done
113
114 teardown $dir || return 1
115 }
116
117 main test-erasure-code-plugins "$@"