Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / test / test_pools.sh
1 #!/bin/bash -x
2
3 #
4 # Test pools
5 #
6
7 # Includes
8 source "`dirname $0`/test_common.sh"
9
10 # Functions
11 setup() {
12         export CEPH_NUM_OSD=$1
13
14         # Start ceph
15         ./stop.sh
16
17         ./vstart.sh -d -n || die "vstart failed"
18 }
19
20 test629_impl() {
21         # create the pool
22         ./rados -c ./ceph.conf mkpool foo || die "mkpool failed"
23
24         # Write lots and lots of objects
25         write_objects 1 1 10 1000000 foo
26
27         # Take down first osd
28         stop_osd 0
29
30         # Now degraded PGs should exist
31         poll_cmd "./ceph pg debug degraded_pgs_exist" TRUE 3 120
32
33         # delete the pool
34         ./rados -c ./ceph.conf rmpool foo || die "rmpool failed"
35
36         # make sure the system is stable
37         sleep 10
38 }
39
40 test629(){
41         setup 3
42         test629_impl
43 }
44
45 run() {
46         test629 || die "test failed"
47 }
48
49 $@