3 source $CEPH_ROOT/qa
/standalone
/ceph-helpers.sh
5 [ `uname` = FreeBSD
] && exit 0
11 export CEPH_MON
="127.0.0.1:7146" # git grep '\<7146\>' : there must be only one
13 CEPH_ARGS
+="--fsid=$(uuidgen) --auth-supported=none "
14 CEPH_ARGS
+="--mon-host=$CEPH_MON "
15 CEPH_ARGS
+="--bluestore_block_size=2147483648 "
16 CEPH_ARGS
+="--bluestore_block_db_create=true "
17 CEPH_ARGS
+="--bluestore_block_db_size=1073741824 "
18 CEPH_ARGS
+="--bluestore_block_wal_size=536870912 "
19 CEPH_ARGS
+="--bluestore_bluefs_min=536870912 "
20 CEPH_ARGS
+="--bluestore_bluefs_min_free=536870912 "
21 CEPH_ARGS
+="--bluestore_block_wal_create=true "
22 CEPH_ARGS
+="--bluestore_fsck_on_mount=true "
23 local funcs
=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
24 for func
in $funcs ; do
25 setup
$dir ||
return 1
26 $func $dir ||
return 1
27 teardown
$dir ||
return 1
31 function TEST_bluestore
() {
34 local flimit
=$
(ulimit -n)
35 if [ $flimit -lt 1536 ]; then
36 echo "Low open file limit ($flimit), test may fail. Increase to 1536 or higher and retry if that happens."
39 run_mon
$dir a ||
return 1
40 run_mgr
$dir x ||
return 1
41 run_osd
$dir 0 ||
return 1
42 osd_pid0
=$
(cat $dir/osd
.0.pid
)
43 run_osd
$dir 1 ||
return 1
44 osd_pid1
=$
(cat $dir/osd
.1.pid
)
45 run_osd
$dir 2 ||
return 1
46 osd_pid2
=$
(cat $dir/osd
.2.pid
)
47 run_osd
$dir 3 ||
return 1
48 osd_pid3
=$
(cat $dir/osd
.3.pid
)
55 timeout
60 rados bench
-p foo
30 write -b 4096 --no-cleanup #|| return 1
60 while kill $osd_pid0; do sleep 1 ; done
62 while kill $osd_pid1; do sleep 1 ; done
64 while kill $osd_pid2; do sleep 1 ; done
66 while kill $osd_pid3; do sleep 1 ; done
70 ceph-bluestore-tool
--path $dir/0 fsck ||
return 1
71 ceph-bluestore-tool
--path $dir/1 fsck ||
return 1
72 ceph-bluestore-tool
--path $dir/2 fsck ||
return 1
73 ceph-bluestore-tool
--path $dir/3 fsck ||
return 1
75 truncate
$dir/0/block
-s 4294967296 # 4GB
76 ceph-bluestore-tool
--path $dir/0 bluefs-bdev-expand ||
return 1
77 truncate
$dir/1/block
-s 4311744512 # 4GB + 16MB
78 ceph-bluestore-tool
--path $dir/1 bluefs-bdev-expand ||
return 1
79 truncate
$dir/2/block
-s 4295099392 # 4GB + 129KB
80 ceph-bluestore-tool
--path $dir/2 bluefs-bdev-expand ||
return 1
81 truncate
$dir/3/block
-s 4293918720 # 4GB - 1MB
82 ceph-bluestore-tool
--path $dir/3 bluefs-bdev-expand ||
return 1
84 # slow, DB, WAL -> slow, DB
85 ceph-bluestore-tool
--path $dir/0 fsck ||
return 1
86 ceph-bluestore-tool
--path $dir/1 fsck ||
return 1
87 ceph-bluestore-tool
--path $dir/2 fsck ||
return 1
88 ceph-bluestore-tool
--path $dir/3 fsck ||
return 1
90 ceph-bluestore-tool
--path $dir/0 bluefs-bdev-sizes
92 ceph-bluestore-tool
--path $dir/0 \
93 --devs-source $dir/0/block.wal \
94 --dev-target $dir/0/block.db \
95 --command bluefs-bdev-migrate ||
return 1
97 ceph-bluestore-tool
--path $dir/0 fsck ||
return 1
99 # slow, DB, WAL -> slow, WAL
100 ceph-bluestore-tool
--path $dir/1 \
101 --devs-source $dir/1/block.db \
102 --dev-target $dir/1/block \
103 --command bluefs-bdev-migrate ||
return 1
105 ceph-bluestore-tool
--path $dir/1 fsck ||
return 1
107 # slow, DB, WAL -> slow
108 ceph-bluestore-tool
--path $dir/2 \
109 --devs-source $dir/2/block.wal \
110 --devs-source $dir/2/block.db \
111 --dev-target $dir/2/block \
112 --command bluefs-bdev-migrate ||
return 1
114 ceph-bluestore-tool
--path $dir/2 fsck ||
return 1
116 # slow, DB, WAL -> slow, WAL (negative case)
117 ceph-bluestore-tool
--path $dir/3 \
118 --devs-source $dir/3/block.db \
119 --dev-target $dir/3/block.wal \
120 --command bluefs-bdev-migrate
122 # Migration to WAL is unsupported
123 if [ $?
-eq 0 ]; then
126 ceph-bluestore-tool
--path $dir/3 fsck ||
return 1
128 # slow, DB, WAL -> slow, DB (WAL to slow then slow to DB)
129 ceph-bluestore-tool
--path $dir/3 \
130 --devs-source $dir/3/block.wal \
131 --dev-target $dir/3/block \
132 --command bluefs-bdev-migrate ||
return 1
134 ceph-bluestore-tool
--path $dir/3 fsck ||
return 1
136 ceph-bluestore-tool
--path $dir/3 \
137 --devs-source $dir/3/block \
138 --dev-target $dir/3/block.db \
139 --command bluefs-bdev-migrate ||
return 1
141 ceph-bluestore-tool
--path $dir/3 fsck ||
return 1
143 activate_osd
$dir 0 ||
return 1
144 osd_pid0
=$
(cat $dir/osd
.0.pid
)
145 activate_osd
$dir 1 ||
return 1
146 osd_pid1
=$
(cat $dir/osd
.1.pid
)
147 activate_osd
$dir 2 ||
return 1
148 osd_pid2
=$
(cat $dir/osd
.2.pid
)
149 activate_osd
$dir 3 ||
return 1
150 osd_pid3
=$
(cat $dir/osd
.3.pid
)
152 wait_for_clean ||
return 1
155 timeout
60 rados bench
-p foo
30 write -b 4096 --no-cleanup #|| return 1
158 while kill $osd_pid0; do sleep 1 ; done
160 while kill $osd_pid1; do sleep 1 ; done
162 while kill $osd_pid2; do sleep 1 ; done
164 while kill $osd_pid3; do sleep 1 ; done
167 # slow, DB -> slow, DB, WAL
168 ceph-bluestore-tool
--path $dir/0 fsck ||
return 1
170 dd if=/dev
/zero of
=$dir/0/wal count
=512 bs
=1M
171 ceph-bluestore-tool
--path $dir/0 \
172 --dev-target $dir/0/wal \
173 --command bluefs-bdev-new-wal ||
return 1
175 ceph-bluestore-tool
--path $dir/0 fsck ||
return 1
177 # slow, WAL -> slow, DB, WAL
178 ceph-bluestore-tool
--path $dir/1 fsck ||
return 1
180 dd if=/dev
/zero of
=$dir/1/db count
=1024 bs
=1M
181 ceph-bluestore-tool
--path $dir/1 \
182 --dev-target $dir/1/db \
183 --command bluefs-bdev-new-db ||
return 1
185 ceph-bluestore-tool
--path $dir/1 \
186 --devs-source $dir/1/block \
187 --dev-target $dir/1/block.db \
188 --command bluefs-bdev-migrate ||
return 1
190 ceph-bluestore-tool
--path $dir/1 fsck ||
return 1
192 # slow -> slow, DB, WAL
193 ceph-bluestore-tool
--path $dir/2 fsck ||
return 1
195 ceph-bluestore-tool
--path $dir/2 \
196 --command bluefs-bdev-new-db ||
return 1
198 ceph-bluestore-tool
--path $dir/2 \
199 --command bluefs-bdev-new-wal ||
return 1
201 ceph-bluestore-tool
--path $dir/2 \
202 --devs-source $dir/2/block \
203 --dev-target $dir/2/block.db \
204 --command bluefs-bdev-migrate ||
return 1
206 ceph-bluestore-tool
--path $dir/2 fsck ||
return 1
208 # slow, DB -> slow, WAL
209 ceph-bluestore-tool
--path $dir/3 fsck ||
return 1
211 ceph-bluestore-tool
--path $dir/3 \
212 --command bluefs-bdev-new-wal ||
return 1
214 ceph-bluestore-tool
--path $dir/3 \
215 --devs-source $dir/3/block.db \
216 --dev-target $dir/3/block \
217 --command bluefs-bdev-migrate ||
return 1
219 ceph-bluestore-tool
--path $dir/3 fsck ||
return 1
221 activate_osd
$dir 0 ||
return 1
222 osd_pid0
=$
(cat $dir/osd
.0.pid
)
223 activate_osd
$dir 1 ||
return 1
224 osd_pid1
=$
(cat $dir/osd
.1.pid
)
225 activate_osd
$dir 2 ||
return 1
226 osd_pid2
=$
(cat $dir/osd
.2.pid
)
227 activate_osd
$dir 3 ||
return 1
228 osd_pid3
=$
(cat $dir/osd
.3.pid
)
231 timeout
60 rados bench
-p foo
30 write -b 4096 --no-cleanup #|| return 1
234 while kill $osd_pid0; do sleep 1 ; done
236 while kill $osd_pid1; do sleep 1 ; done
238 while kill $osd_pid2; do sleep 1 ; done
240 while kill $osd_pid3; do sleep 1 ; done
243 # slow, DB1, WAL -> slow, DB2, WAL
244 ceph-bluestore-tool
--path $dir/0 fsck ||
return 1
246 dd if=/dev
/zero of
=$dir/0/db2 count
=1024 bs
=1M
247 ceph-bluestore-tool
--path $dir/0 \
248 --devs-source $dir/0/block.db \
249 --dev-target $dir/0/db2 \
250 --command bluefs-bdev-migrate ||
return 1
252 ceph-bluestore-tool
--path $dir/0 fsck ||
return 1
254 # slow, DB, WAL1 -> slow, DB, WAL2
256 dd if=/dev
/zero of
=$dir/0/wal2 count
=512 bs
=1M
257 ceph-bluestore-tool
--path $dir/0 \
258 --devs-source $dir/0/block.wal \
259 --dev-target $dir/0/wal2 \
260 --command bluefs-bdev-migrate ||
return 1
263 ceph-bluestore-tool
--path $dir/0 fsck ||
return 1
265 # slow, DB + WAL -> slow, DB2 -> slow
266 ceph-bluestore-tool
--path $dir/1 fsck ||
return 1
268 dd if=/dev
/zero of
=$dir/1/db2 count
=1024 bs
=1M
269 ceph-bluestore-tool
--path $dir/1 \
270 --devs-source $dir/1/block.db \
271 --devs-source $dir/1/block.wal \
272 --dev-target $dir/1/db2 \
273 --command bluefs-bdev-migrate ||
return 1
277 ceph-bluestore-tool
--path $dir/1 fsck ||
return 1
279 ceph-bluestore-tool
--path $dir/1 \
280 --devs-source $dir/1/block.db \
281 --dev-target $dir/1/block \
282 --command bluefs-bdev-migrate ||
return 1
286 ceph-bluestore-tool
--path $dir/1 fsck ||
return 1
288 # slow -> slow, DB (negative case)
289 ceph-objectstore-tool
--type bluestore
--data-path $dir/2 \
290 --op fsck
--no-mon-config ||
return 1
292 dd if=/dev
/zero of
=$dir/2/db2 count
=1024 bs
=1M
293 ceph-bluestore-tool
--path $dir/2 \
294 --devs-source $dir/2/block \
295 --dev-target $dir/2/db2 \
296 --command bluefs-bdev-migrate
298 # Migration from slow-only to new device is unsupported
299 if [ $?
-eq 0 ]; then
302 ceph-bluestore-tool
--path $dir/2 fsck ||
return 1
304 # slow + DB + WAL -> slow, DB2
305 dd if=/dev
/zero of
=$dir/2/db2 count
=1024 bs
=1M
307 ceph-bluestore-tool
--path $dir/2 \
308 --devs-source $dir/2/block \
309 --devs-source $dir/2/block.db \
310 --devs-source $dir/2/block.wal \
311 --dev-target $dir/2/db2 \
312 --command bluefs-bdev-migrate ||
return 1
314 ceph-bluestore-tool
--path $dir/2 fsck ||
return 1
316 # slow + WAL -> slow2, WAL2
317 dd if=/dev
/zero of
=$dir/3/wal2 count
=1024 bs
=1M
319 ceph-bluestore-tool
--path $dir/3 \
320 --devs-source $dir/3/block \
321 --devs-source $dir/3/block.wal \
322 --dev-target $dir/3/wal2 \
323 --command bluefs-bdev-migrate ||
return 1
325 ceph-bluestore-tool
--path $dir/3 fsck ||
return 1
327 activate_osd
$dir 0 ||
return 1
328 osd_pid0
=$
(cat $dir/osd
.0.pid
)
329 activate_osd
$dir 1 ||
return 1
330 osd_pid1
=$
(cat $dir/osd
.1.pid
)
331 activate_osd
$dir 2 ||
return 1
332 osd_pid2
=$
(cat $dir/osd
.2.pid
)
333 activate_osd
$dir 3 ||
return 1
334 osd_pid3
=$
(cat $dir/osd
.3.pid
)
337 timeout
60 rados bench
-p foo
30 write -b 4096 --no-cleanup #|| return 1
339 wait_for_clean ||
return 1
342 main osd-bluefs-volume-ops
"$@"
345 # compile-command: "cd ../.. ; make -j4 && test/osd/osd-bluefs-volume-ops.sh"