3 # Copyright (C) 2017 Tencent <contact@tencent.com>
5 # Author: Chang Liu <liuchang0812@gmail.com>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU Library Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Library Public License for more details.
17 source $CEPH_ROOT/qa
/standalone
/ceph-helpers.sh
23 export CEPH_MON
="127.0.0.1:7113" # git grep '\<7113\>' : there must be only one
25 CEPH_ARGS
+="--fsid=$(uuidgen) --auth-supported=none "
26 CEPH_ARGS
+="--mon-host=$CEPH_MON "
28 local funcs
=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
29 for func
in $funcs ; do
30 setup
$dir ||
return 1
31 $func $dir ||
return 1
32 teardown
$dir ||
return 1
36 function TEST_ceph_df
() {
38 setup
$dir ||
return 1
40 run_mon
$dir a ||
return 1
41 run_osd
$dir 0 ||
return 1
42 run_osd
$dir 1 ||
return 1
43 run_osd
$dir 2 ||
return 1
44 run_osd
$dir 3 ||
return 1
45 run_osd
$dir 4 ||
return 1
46 run_osd
$dir 5 ||
return 1
47 run_mgr
$dir x ||
return 1
49 profile
+=" plugin=jerasure"
50 profile
+=" technique=reed_sol_van"
53 profile
+=" crush-failure-domain=osd"
55 ceph osd erasure-code-profile
set ec42profile
${profile}
57 local rep_poolname
=testcephdf_replicate
58 local ec_poolname
=testcephdf_erasurecode
59 create_pool
$rep_poolname 6 6 replicated
60 create_pool
$ec_poolname 6 6 erasure ec42profile
62 local global_avail
=`ceph df -f json | jq '.stats.total_avail_bytes'`
63 local rep_avail
=`ceph df -f json | jq '.pools | map(select(.name == "$rep_poolname"))[0].stats.max_avail'`
64 local ec_avail
=`ceph df -f json | jq '.pools | map(select(.name == "$ec_poolname"))[0].stats.max_avail'`
66 echo "${global_avail} >= ${rep_avail}*3" |
bc ||
return 1
67 echo "${global_avail} >= ${ec_avail}*1.5" |
bc ||
return 1
69 ceph osd pool delete
$rep_poolname $rep_poolname --yes-i-really-really-mean-it
70 ceph osd pool delete
$ec_poolname $ec_poolname --yes-i-really-really-mean-it
71 ceph osd erasure-code-profile
rm ec42profile
72 teardown
$dir ||
return 1