]> git.proxmox.com Git - ceph.git/blame - ceph/qa/standalone/mon/test_pool_quota.sh
update sources to v12.2.0
[ceph.git] / ceph / qa / standalone / mon / test_pool_quota.sh
CommitLineData
c07f9fc5 1#!/bin/bash
7c673cae
FG
2
3#
4# Generic pool quota test
5#
6
7# Includes
8
7c673cae 9
c07f9fc5 10source $CEPH_ROOT/qa/standalone/ceph-helpers.sh
7c673cae
FG
11
12function run() {
13 local dir=$1
14 shift
15
16 export CEPH_MON="127.0.0.1:17108" # git grep '\<17108\>' : there must be only one
17 export CEPH_ARGS
18 CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none "
19 CEPH_ARGS+="--mon-host=$CEPH_MON "
20
21 local funcs=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
22 for func in $funcs ; do
23 $func $dir || return 1
24 done
25}
26
27function TEST_pool_quota() {
28 local dir=$1
29 setup $dir || return 1
c07f9fc5 30
7c673cae
FG
31 run_mon $dir a || return 1
32 run_osd $dir 0 || return 1
33 run_osd $dir 1 || return 1
34 run_osd $dir 2 || return 1
c07f9fc5 35
7c673cae 36 local poolname=testquoa
b5b8bbf5 37 create_pool $poolname 20
7c673cae
FG
38 local objects=`ceph df detail | grep -w $poolname|awk '{print $3}'`
39 local bytes=`ceph df detail | grep -w $poolname|awk '{print $4}'`
40
41 echo $objects
42 echo $bytes
43 if [ $objects != 'N/A' ] || [ $bytes != 'N/A' ] ;
44 then
45 return 1
46 fi
47
48 ceph osd pool set-quota $poolname max_objects 1000
49 ceph osd pool set-quota $poolname max_bytes 1024
50
51 objects=`ceph df detail | grep -w $poolname|awk '{print $3}'`
52 bytes=`ceph df detail | grep -w $poolname|awk '{print $4}'`
c07f9fc5 53
7c673cae
FG
54 if [ $objects != '1000' ] || [ $bytes != '1024' ] ;
55 then
56 return 1
57 fi
58
59 ceph osd pool delete $poolname $poolname --yes-i-really-really-mean-it
60 teardown $dir || return 1
61}
62
63main testpoolquota