2017-07-20 22:26:42 +00:00
|
|
|
#!/usr/bin/env bash
|
2016-02-03 06:12:25 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Generic pool quota test
|
|
|
|
#
|
|
|
|
|
|
|
|
# Includes
|
2016-04-26 18:27:24 +00:00
|
|
|
|
|
|
|
|
2017-07-21 02:54:48 +00:00
|
|
|
source $CEPH_ROOT/qa/standalone/ceph-helpers.sh
|
2016-02-03 06:12:25 +00:00
|
|
|
|
|
|
|
function run() {
|
|
|
|
local dir=$1
|
|
|
|
shift
|
|
|
|
|
2016-11-17 01:56:17 +00:00
|
|
|
export CEPH_MON="127.0.0.1:17108" # git grep '\<17108\>' : there must be only one
|
2016-02-03 06:12:25 +00:00
|
|
|
export CEPH_ARGS
|
|
|
|
CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none "
|
|
|
|
CEPH_ARGS+="--mon-host=$CEPH_MON "
|
|
|
|
|
|
|
|
local funcs=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
|
|
|
|
for func in $funcs ; do
|
|
|
|
$func $dir || return 1
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
function TEST_pool_quota() {
|
|
|
|
local dir=$1
|
|
|
|
setup $dir || return 1
|
2017-07-21 02:54:48 +00:00
|
|
|
|
2016-02-03 06:12:25 +00:00
|
|
|
run_mon $dir a || return 1
|
|
|
|
run_osd $dir 0 || return 1
|
|
|
|
run_osd $dir 1 || return 1
|
|
|
|
run_osd $dir 2 || return 1
|
2017-07-21 02:54:48 +00:00
|
|
|
|
2017-09-06 03:50:17 +00:00
|
|
|
local poolname=testquota
|
2017-07-31 23:17:16 +00:00
|
|
|
create_pool $poolname 20
|
2016-12-25 18:23:06 +00:00
|
|
|
local objects=`ceph df detail | grep -w $poolname|awk '{print $3}'`
|
|
|
|
local bytes=`ceph df detail | grep -w $poolname|awk '{print $4}'`
|
2016-02-03 06:12:25 +00:00
|
|
|
|
|
|
|
echo $objects
|
|
|
|
echo $bytes
|
|
|
|
if [ $objects != 'N/A' ] || [ $bytes != 'N/A' ] ;
|
|
|
|
then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
ceph osd pool set-quota $poolname max_objects 1000
|
|
|
|
ceph osd pool set-quota $poolname max_bytes 1024
|
|
|
|
|
2016-12-25 18:23:06 +00:00
|
|
|
objects=`ceph df detail | grep -w $poolname|awk '{print $3}'`
|
|
|
|
bytes=`ceph df detail | grep -w $poolname|awk '{print $4}'`
|
2017-05-23 01:53:55 +00:00
|
|
|
|
|
|
|
if [ $objects != '1000' ] || [ $bytes != '1K' ] ;
|
|
|
|
then
|
|
|
|
return 1
|
|
|
|
fi
|
2017-07-21 02:54:48 +00:00
|
|
|
|
2017-05-23 01:53:55 +00:00
|
|
|
ceph osd pool delete $poolname $poolname --yes-i-really-really-mean-it
|
|
|
|
teardown $dir || return 1
|
2016-02-03 06:12:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
main testpoolquota
|