test: Add test for filestore bad CRC in primary pull request

Signed-off-by: David Zafman <dzafman@redhat.com>
This commit is contained in:
David Zafman 2018-08-15 15:42:31 -07:00
parent 381da3f041
commit 72c34949fc

View File

@ -292,6 +292,54 @@ function TEST_rep_recovery_unfound() {
delete_pool $poolname
}
# This is a filestore only test because it requires data digest in object info
function TEST_rep_read_unfound() {
local dir=$1
local objname=myobject
setup_osds 3 || return 1
ceph osd pool delete rbd rbd --yes-i-really-really-mean-it || return 1
local poolname=test-pool
create_pool $poolname 1 1 || return 1
ceph osd pool set $poolname size 2
wait_for_clean || return 1
ceph pg dump pgs
dd if=/dev/urandom bs=8k count=1 of=$dir/ORIGINAL
rados -p $poolname put $objname $dir/ORIGINAL
local primary=$(get_primary $poolname $objname)
local other=$(get_not_primary $poolname $objname)
dd if=/dev/urandom bs=8k count=1 of=$dir/CORRUPT
objectstore_tool $dir $primary $objname set-bytes $dir/CORRUPT || return 1
objectstore_tool $dir $other $objname set-bytes $dir/CORRUPT || return 1
timeout 30 rados -p $poolname get $objname $dir/tmp &
sleep 5
ceph --format=json pg dump pgs | jq '.'
if ! ceph --format=json pg dump pgs | jq '.[0].state' | grep -q recovery_unfound
then
echo "Failure to get to recovery_unfound state"
return 1
fi
objectstore_tool $dir $other $objname set-bytes $dir/ORIGINAL || return 1
wait
if ! cmp $dir/ORIGINAL $dir/tmp
then
echo "Bad data after primary repair"
return 1
fi
}
main osd-rep-recov-eio.sh "$@"
# Local Variables: