mirror of
https://github.com/ceph/ceph
synced 2024-12-21 19:02:10 +00:00
70a1392920
Fixes: #14221 Signed-off-by: Jason Dillaman <dillaman@redhat.com>
43 lines
873 B
Bash
Executable File
43 lines
873 B
Bash
Executable File
#!/bin/bash -ex
|
|
|
|
pool=rbd
|
|
gen=$pool/gen
|
|
data=testfile
|
|
size=64
|
|
dev=/dev/nbd0
|
|
|
|
mkdir -p rbd_nbd_test
|
|
pushd rbd_nbd_test
|
|
|
|
function expect_false()
|
|
{
|
|
if "$@"; then return 1; else return 0; fi
|
|
}
|
|
|
|
rbd remove $gen || true
|
|
sudo rbd-nbd unmap $dev || true
|
|
|
|
#read test
|
|
dd if=/dev/urandom of=$data bs=1M count=$size
|
|
rbd --no-progress import $data $gen
|
|
sudo rbd-nbd --device $dev map $gen
|
|
[ "`dd if=$data bs=1M | md5sum`" != "`sudo dd if=$dev bs=1M | md5sum`" ] && false
|
|
|
|
#write test
|
|
dd if=/dev/urandom of=$data bs=1M count=$size
|
|
sudo dd if=$data of=$dev bs=1M
|
|
sync
|
|
[ "`dd if=$data bs=1M | md5sum`" != "`rbd --no-progress export $gen - | md5sum`" ] && false
|
|
|
|
#trim test
|
|
sudo mkfs.ext4 $dev # better idea?
|
|
sync
|
|
info=`rbd du $gen | tail -n 1`
|
|
[ "`echo $info | awk '{print $2}'`" == "`echo $info | awk '{print $3}'`" ] && false
|
|
|
|
sudo rbd-nbd unmap $dev
|
|
popd
|
|
rm -rf rbd_nbd_test
|
|
|
|
echo OK
|