-#!/bin/bash -e
+#!/usr/bin/env bash
+set -e
. $(dirname $0)/../../standalone/ceph-helpers.sh
function usage()
{
- echo "usage: $0 [-h|-l|-t <testname> [-t <testname>...] [--no-sanity-check] [--no-cleanup]]"
+ echo "usage: $0 [-h|-l|-t <testname> [-t <testname>...] [--no-cleanup]]"
}
function expect_false()
local count=10
save_commit_position ${journal}
- rbd bench-write ${image} --io-size 4096 --io-threads 1 \
+ rbd bench --io-type write ${image} --io-size 4096 --io-threads 1 \
--io-total $((4096 * count)) --io-pattern seq
rbd journal status --image ${image} | fgrep "tid=$((count - 1))"
restore_commit_position ${journal}
rbd snap create ${image1}@test
restore_commit_position ${journal1}
# check that commit position is properly updated: the journal should contain
- # 12 entries (10 AioWrite + 1 SnapCreate + 1 OpFinish) and commit
- # position set to tid=11
+ # 14 entries (2 AioFlush + 10 AioWrite + 1 SnapCreate + 1 OpFinish) and
+ # commit position set to tid=14
rbd journal inspect --image ${image1} --verbose | awk '
+ /AioFlush/ {a++} # match: "event_type": "AioFlush",
/AioWrite/ {w++} # match: "event_type": "AioWrite",
/SnapCreate/ {s++} # match: "event_type": "SnapCreate",
/OpFinish/ {f++} # match: "event_type": "OpFinish",
- /entries inspected/ {t=$1; e=$4} # match: 12 entries inspected, 0 errors
+ /entries inspected/ {t=$1; e=$4} # match: 14 entries inspected, 0 errors
{print} # for diagnostic
END {
- if (w != 10 || s != 1 || f != 1 || t != 12 || e != 0) exit(1)
+ if (a != 2 || w != 10 || s != 1 || f != 1 || t != 14 || e != 0) exit(1)
}
'
rbd remove ${image}
}
+test_rbd_deep_copy()
+{
+ local src=testrbdcopys$$
+ rbd create --size 256 ${src}
+ rbd snap create ${src}@snap1
+
+ local dest=testrbdcopy$$
+ rbd deep copy --image-feature exclusive-lock --image-feature journaling \
+ --journal-pool rbd \
+ --journal-object-size 20M \
+ --journal-splay-width 6 \
+ ${src} ${dest}
+
+ rbd snap purge ${src}
+ rbd remove ${src}
+
+ rbd_assert_eq ${dest} 'journal info' '//journal/order' 25
+ rbd_assert_eq ${dest} 'journal info' '//journal/splay_width' 6
+ rbd_assert_eq ${dest} 'journal info' '//journal/object_pool' rbd
+
+ rbd snap purge ${dest}
+ rbd remove ${dest}
+}
+
test_rbd_clone()
{
local parent=testrbdclonep$$
tests_to_run=()
-sanity_check=true
cleanup=true
while [[ $# -gt 0 ]]; do
"-l" )
do_list=1
;;
- "--no-sanity-check" )
- sanity_check=false
- ;;
"--no-cleanup" )
cleanup=false
;;
fi
for i in $tests_to_run; do
- if $sanity_check ; then
- wait_for_clean
- fi
set -x
test_${i}
set +x
done
-if $sanity_check ; then
- wait_for_clean
-fi
echo OK