]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | #!/usr/bin/env bash |
2 | set -x | |
7c673cae FG |
3 | |
4 | # | |
5 | # Add some objects to the data PGs, and then test splitting those PGs | |
6 | # | |
7 | ||
8 | # Includes | |
9 | source "`dirname $0`/test_common.sh" | |
10 | ||
11 | TEST_POOL=rbd | |
12 | ||
13 | # Constants | |
14 | my_write_objects() { | |
15 | write_objects $1 $2 10 1000000 $TEST_POOL | |
16 | } | |
17 | ||
18 | setup() { | |
19 | export CEPH_NUM_OSD=$1 | |
20 | ||
21 | # Start ceph | |
22 | ./stop.sh | |
23 | ||
24 | ./vstart.sh -d -n | |
25 | } | |
26 | ||
27 | get_pgp_num() { | |
28 | ./ceph -c ./ceph.conf osd pool get $TEST_POOL pgp_num > $TEMPDIR/pgp_num | |
29 | [ $? -eq 0 ] || die "failed to get pgp_num" | |
30 | PGP_NUM=`grep PGP_NUM $TEMPDIR/pgp_num | sed 's/.*PGP_NUM:\([ 0123456789]*\).*$/\1/'` | |
31 | } | |
32 | ||
33 | split1_impl() { | |
34 | # Write lots and lots of objects | |
35 | my_write_objects 1 2 | |
36 | ||
37 | get_pgp_num | |
38 | echo "\$PGP_NUM=$PGP_NUM" | |
39 | ||
40 | # Double the number of PGs | |
41 | PGP_NUM=$((PGP_NUM*2)) | |
42 | echo "doubling PGP_NUM to $PGP_NUM..." | |
43 | ./ceph -c ./ceph.conf osd pool set $TEST_POOL pgp_num $PGP_NUM | |
44 | ||
45 | sleep 30 | |
46 | ||
47 | # success | |
48 | return 0 | |
49 | } | |
50 | ||
51 | split1() { | |
52 | setup 2 | |
53 | split1_impl | |
54 | } | |
55 | ||
56 | many_pools() { | |
57 | setup 3 | |
58 | for i in `seq 1 3000`; do | |
11fdf7f2 | 59 | ./ceph -c ./ceph.conf osd pool create "pool${i}" 8 || die "pool create failed" |
7c673cae FG |
60 | done |
61 | my_write_objects 1 10 | |
62 | } | |
63 | ||
64 | run() { | |
65 | split1 || die "test failed" | |
66 | } | |
67 | ||
68 | $@ |