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