~ubuntu-branches/ubuntu/quantal/ceph/quantal

« back to all changes in this revision

Viewing changes to src/test/test_split.sh

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-07-16 09:56:24 UTC
  • mfrom: (0.3.11)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: package-import@ubuntu.com-20120716095624-azr2w4hbhei1rxmx
Tags: upstream-0.48
ImportĀ upstreamĀ versionĀ 0.48

Show diffs side-by-side

added added

removed removed

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