12 test_rados_tool.sh: tests rados_tool
13 -c: RADOS configuration file to use [optional]
16 -p: set temporary pool to use [optional]
21 if [ "$1" == "--tee" ]; then
32 echo "RUN_EXPECT_FAIL: " "$@"
34 [ $?
-eq 0 ] && die
"expected failure, but got success! cmd: $@"
38 echo "RUN_EXPECT_SUCC: " "$@"
40 [ $?
-ne 0 ] && die
"expected success, but got failure! cmd: $@"
43 run_expect_nosignal
() {
44 echo "RUN_EXPECT_NOSIGNAL: " "$@"
46 [ $?
-ge 128 ] && die
"expected success or fail, but got signal! cmd: $@"
54 if [ -n "$CEPH_BIN" ] ; then
56 RADOS_TOOL
="$CEPH_BIN/rados"
57 CEPH_TOOL
="$CEPH_BIN/ceph"
59 # executables should be installed by the QA env
60 RADOS_TOOL
=$
(which rados
)
61 CEPH_TOOL
=$
(which ceph
)
66 POOL_CP_TARGET
=trs_pool
.2
69 [ -x "$RADOS_TOOL" ] || die
"couldn't find $RADOS_TOOL binary to test"
70 [ -x "$CEPH_TOOL" ] || die
"couldn't find $CEPH_TOOL binary to test"
72 while getopts "c:hkp:" flag
; do
74 c
) RADOS_TOOL
="$RADOS_TOOL -c $OPTARG";;
75 k
) KEEP_TEMP_FILES
=1;;
78 *) echo; usage
; exit 1;;
82 TDIR
=`mktemp -d -t test_rados_tool.XXXXXXXXXX` || die
"mktemp failed"
83 [ $KEEP_TEMP_FILES -eq 0 ] && trap "rm -rf ${TDIR}; exit" INT TERM EXIT
85 # ensure rados doesn't segfault without --pool
86 run_expect_nosignal
"$RADOS_TOOL" --snap "asdf" ls
87 run_expect_nosignal
"$RADOS_TOOL" --snapid "0" ls
88 run_expect_nosignal
"$RADOS_TOOL" --object-locator "asdf" ls
89 run_expect_nosignal
"$RADOS_TOOL" --namespace "asdf" ls
91 run_expect_succ
"$CEPH_TOOL" osd pool create
"$POOL" 8
92 run_expect_succ
"$CEPH_TOOL" osd erasure-code-profile
set myprofile k
=2 m
=1 stripe_unit
=2K crush-failure-domain
=osd
--force
93 run_expect_succ
"$CEPH_TOOL" osd pool create
"$POOL_EC" 100 100 erasure myprofile
96 # expb happens to be the empty export for legacy reasons
97 run_expect_succ
"$RADOS_TOOL" -p "$POOL" export "$TDIR/expb"
99 # expa has objects foo, foo2 and bar
100 run_expect_succ
"$RADOS_TOOL" -p "$POOL" put foo
/etc
/fstab
101 run_expect_succ
"$RADOS_TOOL" -p "$POOL" put foo2
/etc
/fstab
102 run_expect_succ
"$RADOS_TOOL" -p "$POOL" put bar
/etc
/fstab
103 run_expect_succ
"$RADOS_TOOL" -p "$POOL" export "$TDIR/expa"
105 # expc has foo and foo2 with some attributes and omaps set
106 run_expect_succ
"$RADOS_TOOL" -p "$POOL" rm bar
107 run_expect_succ
"$RADOS_TOOL" -p "$POOL" setxattr foo
"rados.toothbrush" "toothbrush"
108 run_expect_succ
"$RADOS_TOOL" -p "$POOL" setxattr foo
"rados.toothpaste" "crest"
109 run_expect_succ
"$RADOS_TOOL" -p "$POOL" setomapval foo
"rados.floss" "myfloss"
110 run_expect_succ
"$RADOS_TOOL" -p "$POOL" setxattr foo2
"rados.toothbrush" "green"
111 run_expect_succ
"$RADOS_TOOL" -p "$POOL" setomapheader foo2
"foo2.header"
112 run_expect_succ
"$RADOS_TOOL" -p "$POOL" export "$TDIR/expc"
114 # make sure that --create works
115 run
"$CEPH_TOOL" osd pool
rm "$POOL" "$POOL" --yes-i-really-really-mean-it
116 run_expect_succ
"$RADOS_TOOL" -p "$POOL" --create import
"$TDIR/expa"
118 # make sure that lack of --create fails
119 run_expect_succ
"$CEPH_TOOL" osd pool
rm "$POOL" "$POOL" --yes-i-really-really-mean-it
120 run_expect_fail
"$RADOS_TOOL" -p "$POOL" import
"$TDIR/expa"
122 run_expect_succ
"$RADOS_TOOL" -p "$POOL" --create import
"$TDIR/expa"
124 # inaccessible import src should fail
125 run_expect_fail
"$RADOS_TOOL" -p "$POOL" import
"$TDIR/dir_nonexistent"
127 # export an empty pool to test purge
128 run_expect_succ
"$RADOS_TOOL" purge
"$POOL" --yes-i-really-really-mean-it
129 run_expect_succ
"$RADOS_TOOL" -p "$POOL" export "$TDIR/empty"
130 cmp -s "$TDIR/expb" "$TDIR/empty" \
131 || die
"failed to export the same stuff we imported!"
134 # import some stuff with extended attributes on it
135 run_expect_succ
"$RADOS_TOOL" -p "$POOL" import
"$TDIR/expc"
136 VAL
=`"$RADOS_TOOL" -p "$POOL" getxattr foo "rados.toothbrush"`
137 [ ${VAL} = "toothbrush" ] || die
"Invalid attribute after import"
139 # the second time, the xattrs should match, so there should be nothing to do.
140 run_expect_succ
"$RADOS_TOOL" -p "$POOL" import
"$TDIR/expc"
141 VAL
=`"$RADOS_TOOL" -p "$POOL" getxattr foo "rados.toothbrush"`
142 [ "${VAL}" = "toothbrush" ] || die
"Invalid attribute after second import"
144 # Now try with --no-overwrite option after changing an attribute
145 run_expect_succ
"$RADOS_TOOL" -p "$POOL" setxattr foo
"rados.toothbrush" "dentist"
146 run_expect_succ
"$RADOS_TOOL" -p "$POOL" import
--no-overwrite "$TDIR/expc"
147 VAL
=`"$RADOS_TOOL" -p "$POOL" getxattr foo "rados.toothbrush"`
148 [ "${VAL}" = "dentist" ] || die
"Invalid attribute after second import"
150 # now force it to copy everything
151 run_expect_succ
"$RADOS_TOOL" -p "$POOL" import
"$TDIR/expc"
152 VAL
=`"$RADOS_TOOL" -p "$POOL" getxattr foo "rados.toothbrush"`
153 [ "${VAL}" = "toothbrush" ] || die
"Invalid attribute after second import"
156 run
"$CEPH_TOOL" osd pool
rm "$POOL" "$POOL" --yes-i-really-really-mean-it
157 run
"$CEPH_TOOL" osd pool
rm "$POOL_CP_TARGET" "$POOL_CP_TARGET" --yes-i-really-really-mean-it
158 run_expect_succ
"$CEPH_TOOL" osd pool create
"$POOL" 8
159 run_expect_succ
"$CEPH_TOOL" osd pool create
"$POOL_CP_TARGET" 8
162 mkdir
-p "$TDIR/dir_cp_src"
163 for i
in `seq 1 5`; do
164 fname
="$TDIR/dir_cp_src/f.$i"
166 dd if=/dev
/urandom of
="$fname" bs
=$
((1024*1024)) count
=$i
167 run_expect_succ
"$RADOS_TOOL" -p "$POOL" put
$objname "$fname"
170 for j
in `seq 1 4`; do
171 rand_str
=`dd if=/dev/urandom bs=4 count=1 | hexdump -x`
172 run_expect_succ
"$RADOS_TOOL" -p "$POOL" setxattr
$objname attr.
$j "$rand_str"
173 run_expect_succ
--tee "$fname.attr.$j" "$RADOS_TOOL" -p "$POOL" getxattr
$objname attr.
$j
176 rand_str
=`dd if=/dev/urandom bs=4 count=1 | hexdump -x`
177 run_expect_succ
"$RADOS_TOOL" -p "$POOL" setomapheader
$objname "$rand_str"
178 run_expect_succ
--tee "$fname.omap.header" "$RADOS_TOOL" -p "$POOL" getomapheader
$objname
180 # a few random omap keys
181 for j
in `seq 1 4`; do
182 rand_str
=`dd if=/dev/urandom bs=4 count=1 | hexdump -x`
183 run_expect_succ
"$RADOS_TOOL" -p "$POOL" setomapval
$objname key.
$j "$rand_str"
185 run_expect_succ
--tee "$fname.omap.vals" "$RADOS_TOOL" -p "$POOL" listomapvals
$objname
188 run_expect_succ
"$RADOS_TOOL" cppool
"$POOL" "$POOL_CP_TARGET"
190 mkdir
-p "$TDIR/dir_cp_dst"
191 for i
in `seq 1 5`; do
192 fname
="$TDIR/dir_cp_dst/f.$i"
194 run_expect_succ
"$RADOS_TOOL" -p "$POOL_CP_TARGET" get
$objname "$fname"
197 for j
in `seq 1 4`; do
198 run_expect_succ
--tee "$fname.attr.$j" "$RADOS_TOOL" -p "$POOL_CP_TARGET" getxattr
$objname attr.
$j
201 run_expect_succ
--tee "$fname.omap.header" "$RADOS_TOOL" -p "$POOL_CP_TARGET" getomapheader
$objname
202 run_expect_succ
--tee "$fname.omap.vals" "$RADOS_TOOL" -p "$POOL_CP_TARGET" listomapvals
$objname
205 diff -q -r "$TDIR/dir_cp_src" "$TDIR/dir_cp_dst" \
206 || die
"copy pool validation failed!"
222 run_expect_succ
"$RADOS_TOOL" --$opt 4 df
223 run_expect_fail
"$RADOS_TOOL" --$opt 4k df
226 run_expect_succ
"$RADOS_TOOL" lock list f
.1 --lock-duration 4 --pool "$POOL"
227 echo # previous command doesn't output an end of line: issue #9735
228 run_expect_fail
"$RADOS_TOOL" lock list f
.1 --lock-duration 4k
--pool "$POOL"
230 run_expect_succ
"$RADOS_TOOL" mksnap snap1
--pool "$POOL"
231 snapid
=$
("$RADOS_TOOL" lssnap
--pool "$POOL" |
grep snap1 | cut
-f1)
232 [ $?
-ne 0 ] && die
"expected success, but got failure! cmd: \"$RADOS_TOOL\" lssnap --pool \"$POOL\" | grep snap1 | cut -f1"
233 run_expect_succ
"$RADOS_TOOL" ls --pool "$POOL" --snapid="$snapid"
234 run_expect_fail
"$RADOS_TOOL" ls --pool "$POOL" --snapid="$snapid"k
236 run_expect_succ
"$RADOS_TOOL" truncate f
.1 0 --pool "$POOL"
237 run_expect_fail
"$RADOS_TOOL" truncate f
.1 0k
--pool "$POOL"
239 run
"$CEPH_TOOL" osd pool
rm delete_me_mkpool_test delete_me_mkpool_test
--yes-i-really-really-mean-it
240 run_expect_succ
"$CEPH_TOOL" osd pool create delete_me_mkpool_test
1
242 run_expect_succ
"$RADOS_TOOL" --pool "$POOL" bench
1 write
243 run_expect_fail
"$RADOS_TOOL" --pool "$POOL" bench
1k
write
244 run_expect_succ
"$RADOS_TOOL" --pool "$POOL" bench
1 write --format json
--output "$TDIR/bench.json"
245 run_expect_fail
"$RADOS_TOOL" --pool "$POOL" bench
1 write --output "$TDIR/bench.json"
246 run_expect_succ
"$RADOS_TOOL" --pool "$POOL" bench
5 write --format json
--no-cleanup
247 run_expect_succ
"$RADOS_TOOL" --pool "$POOL" bench
1 rand
--format json
248 run_expect_succ
"$RADOS_TOOL" --pool "$POOL" bench
1 rand
-f json
249 run_expect_succ
"$RADOS_TOOL" --pool "$POOL" bench
1 seq --format json
250 run_expect_succ
"$RADOS_TOOL" --pool "$POOL" bench
1 seq -f json
251 run_expect_succ
"$RADOS_TOOL" --pool "$POOL" bench
5 write --write-omap
252 run_expect_succ
"$RADOS_TOOL" --pool "$POOL" bench
5 write --write-object
253 run_expect_succ
"$RADOS_TOOL" --pool "$POOL" bench
5 write --write-xattr
254 run_expect_succ
"$RADOS_TOOL" --pool "$POOL" bench
5 write --write-xattr --write-object
255 run_expect_succ
"$RADOS_TOOL" --pool "$POOL" bench
5 write --write-xattr --write-omap
256 run_expect_succ
"$RADOS_TOOL" --pool "$POOL" bench
5 write --write-omap --write-object
257 run_expect_succ
"$RADOS_TOOL" --pool "$POOL" bench
5 write --write-xattr --write-omap --write-object
258 run_expect_fail
"$RADOS_TOOL" --pool "$POOL" bench
5 read --write-omap
259 run_expect_fail
"$RADOS_TOOL" --pool "$POOL" bench
5 read --write-object
260 run_expect_fail
"$RADOS_TOOL" --pool "$POOL" bench
5 read --write-xattr
261 run_expect_fail
"$RADOS_TOOL" --pool "$POOL" bench
5 read --write-xattr --write-object
262 run_expect_fail
"$RADOS_TOOL" --pool "$POOL" bench
5 read --write-xattr --write-omap
263 run_expect_fail
"$RADOS_TOOL" --pool "$POOL" bench
5 read --write-omap --write-object
264 run_expect_fail
"$RADOS_TOOL" --pool "$POOL" bench
5 read --write-xattr --write-omap --write-object
266 for i
in $
("$RADOS_TOOL" --pool "$POOL" ls |
grep "benchmark_data"); do
267 "$RADOS_TOOL" --pool "$POOL" truncate
$i 0
270 run_expect_nosignal
"$RADOS_TOOL" --pool "$POOL" bench
1 rand
271 run_expect_nosignal
"$RADOS_TOOL" --pool "$POOL" bench
1 seq
279 if "$@"; then return 1; else return 0; fi
283 $RADOS_TOOL -p $POOL rm $OBJ > /dev
/null
2>&1 || true
284 $RADOS_TOOL -p $POOL_EC rm $OBJ > /dev
/null
2>&1 || true
289 for i
in $
(seq 1 1 10)
291 if [ $
(($i % 2)) -eq 0 ]; then
292 $RADOS_TOOL -p $POOL setomapval
$OBJ $i $i
294 echo -n "$i" |
$RADOS_TOOL -p $POOL setomapval
$OBJ $i
296 $RADOS_TOOL -p $POOL getomapval
$OBJ $i |
grep -q "|$i|\$"
298 $RADOS_TOOL -p $POOL listomapvals
$OBJ |
grep -c value |
grep 10
299 for i
in $
(seq 1 1 5)
301 $RADOS_TOOL -p $POOL rmomapkey
$OBJ $i
303 $RADOS_TOOL -p $POOL listomapvals
$OBJ |
grep -c value |
grep 5
304 $RADOS_TOOL -p $POOL clearomap
$OBJ
305 $RADOS_TOOL -p $POOL listomapvals
$OBJ |
wc -l |
grep 0
308 for i
in $
(seq 1 1 10)
310 dd if=/dev
/urandom bs
=128 count
=1 > $TDIR/omap_key
311 if [ $
(($i % 2)) -eq 0 ]; then
312 $RADOS_TOOL -p $POOL --omap-key-file $TDIR/omap_key setomapval
$OBJ $i
314 echo -n "$i" |
$RADOS_TOOL -p $POOL --omap-key-file $TDIR/omap_key setomapval
$OBJ
316 $RADOS_TOOL -p $POOL --omap-key-file $TDIR/omap_key getomapval
$OBJ |
grep -q "|$i|\$"
317 $RADOS_TOOL -p $POOL --omap-key-file $TDIR/omap_key rmomapkey
$OBJ
318 $RADOS_TOOL -p $POOL listomapvals
$OBJ |
grep -c value |
grep 0
325 $RADOS_TOOL -p $POOL put
$OBJ /etc
/passwd
326 V1
=`mktemp fooattrXXXXXXX`
327 V2
=`mktemp fooattrXXXXXXX`
329 expect_false
$RADOS_TOOL -p $POOL setxattr
$OBJ 2>/dev
/null
330 expect_false
$RADOS_TOOL -p $POOL setxattr
$OBJ foo fooval extraarg
2>/dev
/null
331 $RADOS_TOOL -p $POOL setxattr
$OBJ foo fooval
332 $RADOS_TOOL -p $POOL getxattr
$OBJ foo
> $V2
334 cat $V1 |
$RADOS_TOOL -p $POOL setxattr
$OBJ bar
335 $RADOS_TOOL -p $POOL getxattr
$OBJ bar
> $V2
337 $RADOS_TOOL -p $POOL listxattr
$OBJ > $V1
340 [ `cat $V1 | wc -l` -eq 2 ]
346 $CEPH_TOOL osd pool create
$p 1
347 $CEPH_TOOL osd pool set-quota
$p max_objects
1
348 V1
=`mktemp fooattrXXXXXXX`
349 $RADOS_TOOL put
$OBJ $V1 -p $p
350 while ! $CEPH_TOOL osd dump |
grep 'full_quota max_objects'
354 $RADOS_TOOL -p $p rm $OBJ --force-full
355 $CEPH_TOOL osd pool
rm $p $p --yes-i-really-really-mean-it
360 echo "Testing rados ls command"
362 $CEPH_TOOL osd pool create
$p 1
365 # Include default namespace (0) in the total
366 TOTAL
=$
(expr $OBJS \
* $
(expr $NS + 1))
368 for nsnum
in `seq 0 $NS`
370 for onum
in `seq 1 $OBJS`
372 if [ "$nsnum" = "0" ];
374 "$RADOS_TOOL" -p $p put obj
${onum} /etc
/fstab
2> /dev
/null
376 "$RADOS_TOOL" -p $p -N "NS${nsnum}" put obj
${onum} /etc
/fstab
2> /dev
/null
380 CHECK
=$
("$RADOS_TOOL" -p $p ls 2> /dev
/null |
wc -l)
381 if [ "$OBJS" -ne "$CHECK" ];
383 die
"Created $OBJS objects in default namespace but saw $CHECK"
386 CHECK
=$
("$RADOS_TOOL" -p $p -N $TESTNS ls 2> /dev
/null |
wc -l)
387 if [ "$OBJS" -ne "$CHECK" ];
389 die
"Created $OBJS objects in $TESTNS namespace but saw $CHECK"
391 CHECK
=$
("$RADOS_TOOL" -p $p --all ls 2> /dev
/null |
wc -l)
392 if [ "$TOTAL" -ne "$CHECK" ];
394 die
"Created $TOTAL objects but saw $CHECK"
397 $CEPH_TOOL osd pool
rm $p $p --yes-i-really-really-mean-it
401 echo "Testing rados cleanup command"
403 $CEPH_TOOL osd pool create
$p 1
406 # Include default namespace (0) in the total
407 TOTAL
=$
(expr $OBJS \
* $
(expr $NS + 1))
409 for nsnum
in `seq 0 $NS`
411 for onum
in `seq 1 $OBJS`
413 if [ "$nsnum" = "0" ];
415 "$RADOS_TOOL" -p $p put obj
${onum} /etc
/fstab
2> /dev
/null
417 "$RADOS_TOOL" -p $p -N "NS${nsnum}" put obj
${onum} /etc
/fstab
2> /dev
/null
422 $RADOS_TOOL -p $p --all ls > $TDIR/before.
ls.out
2> /dev
/null
424 $RADOS_TOOL -p $p bench
3 write --no-cleanup 2> /dev
/null
425 $RADOS_TOOL -p $p -N NS1 bench
3 write --no-cleanup 2> /dev
/null
426 $RADOS_TOOL -p $p -N NS2 bench
3 write --no-cleanup 2> /dev
/null
427 $RADOS_TOOL -p $p -N NS3 bench
3 write --no-cleanup 2> /dev
/null
428 # Leave dangling objects without a benchmark_last_metadata in NS4
429 expect_false timeout
3 $RADOS_TOOL -p $p -N NS4 bench
30 write --no-cleanup 2> /dev
/null
430 $RADOS_TOOL -p $p -N NS5 bench
3 write --no-cleanup 2> /dev
/null
432 $RADOS_TOOL -p $p -N NS3 cleanup
2> /dev
/null
433 #echo "Check NS3 after specific cleanup"
434 CHECK
=$
($RADOS_TOOL -p $p -N NS3
ls |
wc -l)
435 if [ "$OBJS" -ne "$CHECK" ] ;
437 die
"Expected $OBJS objects in NS3 but saw $CHECK"
440 #echo "Try to cleanup all"
441 $RADOS_TOOL -p $p --all cleanup
442 #echo "Check all namespaces"
443 $RADOS_TOOL -p $p --all ls > $TDIR/after.
ls.out
2> /dev
/null
444 CHECK
=$
(cat $TDIR/after.
ls.out |
wc -l)
445 if [ "$TOTAL" -ne "$CHECK" ];
447 die
"Expected $TOTAL objects but saw $CHECK"
449 if ! diff $TDIR/before.
ls.out
$TDIR/after.
ls.out
451 die
"Different objects found after cleanup"
455 run_expect_fail
$RADOS_TOOL -p $p cleanup
--prefix illegal_prefix
456 run_expect_succ
$RADOS_TOOL -p $p cleanup
--prefix benchmark_data_otherhost
459 $CEPH_TOOL osd pool
rm $p $p --yes-i-really-really-mean-it
462 function test_append
()
467 touch .
/rados_append_null
468 $RADOS_TOOL -p $POOL append
$OBJ .
/rados_append_null
469 $RADOS_TOOL -p $POOL get
$OBJ .
/rados_append_0_out
470 cmp .
/rados_append_null .
/rados_append_0_out
472 # append 4k, total size 4k
473 dd if=/dev
/zero of
=.
/rados_append_4k bs
=4k count
=1
474 $RADOS_TOOL -p $POOL append
$OBJ .
/rados_append_4k
475 $RADOS_TOOL -p $POOL get
$OBJ .
/rados_append_4k_out
476 cmp .
/rados_append_4k .
/rados_append_4k_out
478 # append 4k, total size 8k
479 $RADOS_TOOL -p $POOL append
$OBJ .
/rados_append_4k
480 $RADOS_TOOL -p $POOL get
$OBJ .
/rados_append_4k_out
481 read_size
=`ls -l ./rados_append_4k_out | awk -F ' ' '{print $5}'`
482 if [ 8192 -ne $read_size ];
484 die
"Append failed expecting 8192 read $read_size"
487 # append 10M, total size 10493952
488 dd if=/dev
/zero of
=.
/rados_append_10m bs
=10M count
=1
489 $RADOS_TOOL -p $POOL append
$OBJ .
/rados_append_10m
490 $RADOS_TOOL -p $POOL get
$OBJ .
/rados_append_10m_out
491 read_size
=`ls -l ./rados_append_10m_out | awk -F ' ' '{print $5}'`
492 if [ 10493952 -ne $read_size ];
494 die
"Append failed expecting 10493952 read $read_size"
501 $RADOS_TOOL -p $POOL_EC append
$OBJ .
/rados_append_null
502 $RADOS_TOOL -p $POOL_EC get
$OBJ .
/rados_append_0_out
503 cmp rados_append_null rados_append_0_out
505 # append 4k, total size 4k
506 $RADOS_TOOL -p $POOL_EC append
$OBJ .
/rados_append_4k
507 $RADOS_TOOL -p $POOL_EC get
$OBJ .
/rados_append_4k_out
508 cmp rados_append_4k rados_append_4k_out
510 # append 4k, total size 8k
511 $RADOS_TOOL -p $POOL_EC append
$OBJ .
/rados_append_4k
512 $RADOS_TOOL -p $POOL_EC get
$OBJ .
/rados_append_4k_out
513 read_size
=`ls -l ./rados_append_4k_out | awk -F ' ' '{print $5}'`
514 if [ 8192 -ne $read_size ];
516 die
"Append failed expecting 8192 read $read_size"
519 # append 10M, total size 10493952
520 $RADOS_TOOL -p $POOL_EC append
$OBJ .
/rados_append_10m
521 $RADOS_TOOL -p $POOL_EC get
$OBJ .
/rados_append_10m_out
522 read_size
=`ls -l ./rados_append_10m_out | awk -F ' ' '{print $5}'`
523 if [ 10493952 -ne $read_size ];
525 die
"Append failed expecting 10493952 read $read_size"
529 rm -rf .
/rados_append_null .
/rados_append_0_out
530 rm -rf .
/rados_append_4k .
/rados_append_4k_out .
/rados_append_10m .
/rados_append_10m_out
538 # create file in local fs
539 dd if=/dev
/urandom of
=rados_object_10k bs
=1K count
=10
542 $RADOS_TOOL -p $POOL put
$OBJ .
/rados_object_10k
543 $RADOS_TOOL -p $POOL get
$OBJ .
/rados_object_10k_out
544 cmp .
/rados_object_10k .
/rados_object_10k_out
547 # test put command with offset 0
548 $RADOS_TOOL -p $POOL put
$OBJ .
/rados_object_10k
--offset 0
549 $RADOS_TOOL -p $POOL get
$OBJ .
/rados_object_offset_0_out
550 cmp .
/rados_object_10k .
/rados_object_offset_0_out
553 # test put command with offset 1000
554 $RADOS_TOOL -p $POOL put
$OBJ .
/rados_object_10k
--offset 1000
555 $RADOS_TOOL -p $POOL get
$OBJ .
/rados_object_offset_1000_out
556 cmp .
/rados_object_10k .
/rados_object_offset_1000_out
0 1000
559 rm -rf .
/rados_object_10k .
/rados_object_10k_out .
/rados_object_offset_0_out .
/rados_object_offset_1000_out
564 bluestore
=$
("$CEPH_TOOL" osd metadata |
grep '"osd_objectstore": "bluestore"' | cut
-f1)
565 # create file in local fs
566 dd if=/dev
/urandom of
=rados_object_128k bs
=64K count
=2
568 # rados df test (replicated_pool):
569 $RADOS_TOOL purge
$POOL --yes-i-really-really-mean-it
570 $CEPH_TOOL osd pool
rm $POOL $POOL --yes-i-really-really-mean-it
571 $CEPH_TOOL osd pool create
$POOL 8
572 $CEPH_TOOL osd pool
set $POOL size
3
574 # put object with 1 MB gap in front
575 $RADOS_TOOL -p $POOL put
$OBJ .
/rados_object_128k
--offset=1048576
577 if [ "" == "$bluestore" ];
587 IN
=$
($RADOS_TOOL -p $POOL df |
grep $POOL ; [[ ! -z $?
]] && echo "")
588 [[ -z $IN ]] && sleep 1 && continue
589 IFS
=' ' read -ra VALS
<<< "$IN"
591 # verification is a bit tricky due to stats report's eventual model
593 # VALS[2] - STORED units
598 # VALS[14] - WR uints
599 # implies replication factor 3
600 if [ ${VALS[1]} == $STORED ] && [ ${VALS[2]} == $STORED_UNIT ] && [ ${VALS[3]} == "1" ] && [ ${VALS[5]} == "3" ] && [ ${VALS[12]} == "1" ] && [ ${VALS[13]} == 128 ] && [ ${VALS[14]} == "KiB" ]
602 # enforce multiple match to make sure stats aren't changing any more
603 MATCH_CNT
=$
((MATCH_CNT
+1))
604 [[ $MATCH_CNT == 3 ]] && break
612 [[ -z $IN ]] && die
"Failed to retrieve any pool stats within 60 seconds"
613 if [ ${VALS[1]} != $STORED ] || [ ${VALS[2]} != $STORED_UNIT ] || [ ${VALS[3]} != "1" ] || [ ${VALS[5]} != "3" ] || [ ${VALS[12]} != "1" ] || [ ${VALS[13]} != 128 ] || [ ${VALS[14]} != "KiB" ]
615 die
"Failed to retrieve proper pool stats within 60 seconds"
618 # overwrite data at 1MB offset
619 $RADOS_TOOL -p $POOL put
$OBJ .
/rados_object_128k
--offset=1048576
621 if [ "" == "$bluestore" ];
631 IN
=$
($RADOS_TOOL -p $POOL df |
grep $POOL ; [[ ! -z $?
]] && echo "")
632 IFS
=' ' read -ra VALS
<<< "$IN"
634 # verification is a bit tricky due to stats report's eventual model
636 # VALS[2] - STORED units
641 # VALS[14] - WR uints
642 # implies replication factor 3
643 if [ ${VALS[1]} == $STORED ] && [ ${VALS[2]} == $STORED_UNIT ] && [ ${VALS[3]} == "1" ] && [ ${VALS[5]} == "3" ] && [ ${VALS[12]} == "2" ] && [ ${VALS[13]} == 256 ] && [ ${VALS[14]} == "KiB" ]
645 # enforce multiple match to make sure stats aren't changing any more
646 MATCH_CNT
=$
((MATCH_CNT
+1))
647 [[ $MATCH_CNT == 3 ]] && break
655 if [ ${VALS[1]} != $STORED ] || [ ${VALS[2]} != $STORED_UNIT ] || [ ${VALS[3]} != "1" ] || [ ${VALS[5]} != "3" ] || [ ${VALS[12]} != "2" ] || [ ${VALS[13]} != 256 ] || [ ${VALS[14]} != "KiB" ]
657 die
"Failed to retrieve proper pool stats within 60 seconds"
660 # write data at 64K offset
661 $RADOS_TOOL -p $POOL put
$OBJ .
/rados_object_128k
--offset=65536
663 if [ "" == "$bluestore" ];
673 IN
=$
($RADOS_TOOL -p $POOL df |
grep $POOL ; [[ ! -z $?
]] && echo "")
674 IFS
=' ' read -ra VALS
<<< "$IN"
676 # verification is a bit tricky due to stats report's eventual model
678 # VALS[2] - STORED units
683 # VALS[14] - WR uints
684 # implies replication factor 3
685 if [ ${VALS[1]} == $STORED ] && [ ${VALS[2]} == $STORED_UNIT ] && [ ${VALS[3]} == "1" ] && [ ${VALS[5]} == "3" ] && [ ${VALS[12]} == "3" ] && [ ${VALS[13]} == 384 ] && [ ${VALS[14]} == "KiB" ]
687 # enforce multiple match to make sure stats aren't changing any more
688 MATCH_CNT
=$
((MATCH_CNT
+1))
689 [[ $MATCH_CNT == 3 ]] && break
697 if [ ${VALS[1]} != $STORED ] || [ ${VALS[2]} != $STORED_UNIT ] || [ ${VALS[3]} != "1" ] || [ ${VALS[5]} != "3" ] || [ ${VALS[12]} != "3" ] || [ ${VALS[13]} != 384 ] || [ ${VALS[14]} != "KiB" ]
699 die
"Failed to retrieve proper pool stats within 60 seconds"
702 # overwrite object totally
703 $RADOS_TOOL -p $POOL put
$OBJ .
/rados_object_128k
705 if [ "" == "$bluestore" ];
715 IN
=$
($RADOS_TOOL -p $POOL df |
grep $POOL ; [[ ! -z $?
]] && echo "")
716 IFS
=' ' read -ra VALS
<<< "$IN"
718 # verification is a bit tricky due to stats report's eventual model
720 # VALS[2] - STORED units
725 # VALS[14] - WR uints
726 # implies replication factor 3
727 if [ ${VALS[1]} == $STORED ] && [ ${VALS[2]} == $STORED_UNIT ] && [ ${VALS[3]} == "1" ] && [ ${VALS[5]} == "3" ] && [ ${VALS[12]} == "4" ] && [ ${VALS[13]} == 512 ] && [ ${VALS[14]} == "KiB" ]
729 # enforce multiple match to make sure stats aren't changing any more
730 MATCH_CNT
=$
((MATCH_CNT
+1))
731 [[ $MATCH_CNT == 3 ]] && break
739 if [ ${VALS[1]} != $STORED ] || [ ${VALS[2]} != $STORED_UNIT ] || [ ${VALS[3]} != "1" ] || [ ${VALS[5]} != "3" ] || [ ${VALS[12]} != "4" ] || [ ${VALS[13]} != 512 ] || [ ${VALS[14]} != "KiB" ]
741 die
"Failed to retrieve proper pool stats within 60 seconds"
750 IN
=$
($RADOS_TOOL -p $POOL df |
grep $POOL ; [[ ! -z $?
]] && echo "")
751 IFS
=' ' read -ra VALS
<<< "$IN"
753 # verification is a bit tricky due to stats report's eventual model
755 # VALS[2] - STORED units
760 # VALS[14] - WR uints
761 # implies replication factor 3
762 if [ ${VALS[1]} == 0 ] && [ ${VALS[2]} == "B" ] && [ ${VALS[3]} == "0" ] && [ ${VALS[5]} == "0" ] && [ ${VALS[12]} == "5" ] && [ ${VALS[13]} == 512 ] && [ ${VALS[14]} == "KiB" ]
764 # enforce multiple match to make sure stats aren't changing any more
765 MATCH_CNT
=$
((MATCH_CNT
+1))
766 [[ $MATCH_CNT == 3 ]] && break
774 if [ ${VALS[1]} != 0 ] || [ ${VALS[2]} != "B" ] || [ ${VALS[3]} != "0" ] || [ ${VALS[5]} != "0" ] || [ ${VALS[12]} != "5" ] || [ ${VALS[13]} != 512 ] || [ ${VALS[14]} != "KiB" ]
776 die
"Failed to retrieve proper pool stats within 60 seconds"
779 ############ rados df test (EC pool): ##############
780 $RADOS_TOOL purge
$POOL_EC --yes-i-really-really-mean-it
781 $CEPH_TOOL osd pool
rm $POOL_EC $POOL_EC --yes-i-really-really-mean-it
782 $CEPH_TOOL osd erasure-code-profile
set myprofile k
=2 m
=1 stripe_unit
=2K crush-failure-domain
=osd
--force
783 $CEPH_TOOL osd pool create
$POOL_EC 8 8 erasure
786 $RADOS_TOOL -p $POOL_EC put
$OBJ .
/rados_object_128k
788 if [ "" == "$bluestore" ];
798 IN
=$
($RADOS_TOOL -p $POOL_EC df |
grep $POOL_EC ; [[ ! -z $?
]] && echo "")
799 [[ -z $IN ]] && sleep 1 && continue
800 IFS
=' ' read -ra VALS
<<< "$IN"
802 # verification is a bit tricky due to stats report's eventual model
804 # VALS[2] - STORED units
809 # VALS[14] - WR uints
810 # implies replication factor 2+1
811 if [ ${VALS[1]} == $STORED ] && [ ${VALS[2]} == $STORED_UNIT ] && [ ${VALS[3]} == "1" ] && [ ${VALS[5]} == "3" ] && [ ${VALS[12]} == "1" ] && [ ${VALS[13]} == 128 ] && [ ${VALS[14]} == "KiB" ]
813 # enforce multiple match to make sure stats aren't changing any more
814 MATCH_CNT
=$
((MATCH_CNT
+1))
815 [[ $MATCH_CNT == 3 ]] && break
823 [[ -z $IN ]] && die
"Failed to retrieve any pool stats within 60 seconds"
824 if [ ${VALS[1]} != $STORED ] || [ ${VALS[2]} != $STORED_UNIT ] || [ ${VALS[3]} != "1" ] || [ ${VALS[5]} != "3" ] || [ ${VALS[12]} != "1" ] || [ ${VALS[13]} != 128 ] || [ ${VALS[14]} != "KiB" ]
826 die
"Failed to retrieve proper pool stats within 60 seconds"
830 $RADOS_TOOL -p $POOL_EC put
$OBJ .
/rados_object_128k
832 if [ "" == "$bluestore" ];
842 IN
=$
($RADOS_TOOL -p $POOL_EC df |
grep $POOL_EC ; [[ ! -z $?
]] && echo "")
843 IFS
=' ' read -ra VALS
<<< "$IN"
845 # verification is a bit tricky due to stats report's eventual model
847 # VALS[2] - STORED units
852 # VALS[14] - WR uints
853 # implies replication factor 2+1
854 if [ ${VALS[1]} == $STORED ] && [ ${VALS[2]} == $STORED_UNIT ] && [ ${VALS[3]} == "1" ] && [ ${VALS[5]} == "3" ] && [ ${VALS[12]} == "2" ] && [ ${VALS[13]} == 256 ] && [ ${VALS[14]} == "KiB" ]
856 # enforce multiple match to make sure stats aren't changing any more
857 MATCH_CNT
=$
((MATCH_CNT
+1))
858 [[ $MATCH_CNT == 3 ]] && break
866 if [ ${VALS[1]} != $STORED ] || [ ${VALS[2]} != $STORED_UNIT ] || [ ${VALS[3]} != "1" ] || [ ${VALS[5]} != "3" ] || [ ${VALS[12]} != "2" ] || [ ${VALS[13]} != 256 ] || [ ${VALS[14]} != "KiB" ]
868 die
"Failed to retrieve proper pool stats within 60 seconds"
877 IN
=$
($RADOS_TOOL -p $POOL_EC df |
grep $POOL_EC ; [[ ! -z $?
]] && echo "")
878 IFS
=' ' read -ra VALS
<<< "$IN"
880 # verification is a bit tricky due to stats report's eventual model
882 # VALS[2] - STORED units
887 # VALS[14] - WR uints
888 # implies replication factor 2+1
889 if [ ${VALS[1]} == 0 ] && [ ${VALS[2]} == "B" ] && [ ${VALS[3]} == "0" ] && [ ${VALS[5]} == "0" ] && [ ${VALS[12]} == "3" ] && [ ${VALS[13]} == 256 ] && [ ${VALS[14]} == "KiB" ]
891 # enforce multiple match to make sure stats aren't changing any more
892 MATCH_CNT
=$
((MATCH_CNT
+1))
893 [[ $MATCH_CNT == 3 ]] && break
901 if [ ${VALS[1]} != 0 ] || [ ${VALS[2]} != "B" ] || [ ${VALS[3]} != "0" ] || [ ${VALS[5]} != "0" ] || [ ${VALS[12]} != "3" ] || [ ${VALS[13]} != 256 ] || [ ${VALS[14]} != "KiB" ]
903 die
"Failed to retrieve proper pool stats within 60 seconds"
906 rm -rf .
/rados_object_128k
918 # clean up environment, delete pool
919 $CEPH_TOOL osd pool delete
$POOL $POOL --yes-i-really-really-mean-it
920 $CEPH_TOOL osd pool delete
$POOL_EC $POOL_EC --yes-i-really-really-mean-it
921 $CEPH_TOOL osd pool delete
$POOL_CP_TARGET $POOL_CP_TARGET --yes-i-really-really-mean-it