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