]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/bin/bash |
2 | ||
3 | source $(dirname $0)/../detect-build-env-vars.sh | |
4 | source $CEPH_ROOT/qa/workunits/ceph-helpers.sh | |
5 | ||
6 | function run() { | |
7 | local dir=$1 | |
8 | shift | |
9 | ||
10 | export CEPH_MON="127.0.0.1:7146" # git grep '\<7146\>' : there must be only one | |
11 | export CEPH_ARGS | |
12 | CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none " | |
13 | CEPH_ARGS+="--mon-host=$CEPH_MON " | |
7c673cae FG |
14 | # avoid running out of fds in rados bench |
15 | CEPH_ARGS+="--filestore_wbthrottle_xfs_ios_hard_limit=900 " | |
16 | CEPH_ARGS+="--filestore_wbthrottle_btrfs_ios_hard_limit=900 " | |
17 | local funcs=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')} | |
18 | for func in $funcs ; do | |
19 | setup $dir || return 1 | |
20 | $func $dir || return 1 | |
21 | teardown $dir || return 1 | |
22 | done | |
23 | } | |
24 | ||
25 | function TEST_filestore_to_bluestore() { | |
26 | local dir=$1 | |
27 | ||
28 | local flimit=$(ulimit -n) | |
29 | if [ $flimit -lt 1536 ]; then | |
30 | echo "Low open file limit ($flimit), test may fail. Increase to 1536 or higher and retry if that happens." | |
31 | fi | |
32 | ||
33 | run_mon $dir a || return 1 | |
31f18b77 | 34 | run_mgr $dir x || return 1 |
7c673cae FG |
35 | run_osd $dir 0 || return 1 |
36 | osd_pid=$(cat $dir/osd.0.pid) | |
37 | run_osd $dir 1 || return 1 | |
38 | run_osd $dir 2 || return 1 | |
39 | ||
40 | sleep 5 | |
41 | ||
42 | ceph osd pool create foo 16 | |
43 | ||
44 | # write some objects | |
45 | rados bench -p foo 10 write -b 4096 --no-cleanup || return 1 | |
46 | ||
47 | # kill | |
48 | while kill $osd_pid; do sleep 1 ; done | |
49 | ceph osd down 0 | |
50 | ||
51 | mv $dir/0 $dir/0.old || return 1 | |
52 | mkdir $dir/0 || return 1 | |
53 | ofsid=$(cat $dir/0.old/fsid) | |
54 | echo "osd fsid $ofsid" | |
55 | O=$CEPH_ARGS | |
56 | CEPH_ARGS+="--log-file $dir/cot.log --log-max-recent 0 " | |
57 | ceph-objectstore-tool --type bluestore --data-path $dir/0 --fsid $ofsid \ | |
58 | --op mkfs || return 1 | |
59 | ceph-objectstore-tool --data-path $dir/0.old --target-data-path $dir/0 \ | |
60 | --op dup || return 1 | |
61 | CEPH_ARGS=$O | |
62 | ||
31f18b77 | 63 | run_osd_bluestore $dir 0 || return 1 |
7c673cae FG |
64 | |
65 | while ! ceph osd stat | grep '3 up' ; do sleep 1 ; done | |
66 | ceph osd metadata 0 | grep bluestore || return 1 | |
67 | ||
68 | ceph osd scrub 0 | |
69 | ||
70 | # give it some time | |
71 | sleep 15 | |
31f18b77 FG |
72 | # and make sure mon is sync'ed |
73 | flush_pg_stats | |
7c673cae | 74 | |
31f18b77 | 75 | wait_for_clean || return 1 |
7c673cae FG |
76 | } |
77 | ||
78 | main osd-dup "$@" | |
79 | ||
80 | # Local Variables: | |
81 | # compile-command: "cd ../.. ; make -j4 && test/osd/osd-dup.sh" | |
82 | # End: |