diff options
author | Sage Weil <sage@newdream.net> | 2011-08-22 16:36:19 -0700 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2011-08-22 16:53:55 -0700 |
commit | 39b6a9c4951ffe499ba017b268315b2b8568fbbd (patch) | |
tree | 4e0b45c1f4f38ba62b771b7c6d770251461984b5 /qa | |
parent | b03a1841b4b08c82fa37a45dc31a0c0255949235 (diff) | |
download | ceph-39b6a9c4951ffe499ba017b268315b2b8568fbbd.tar.gz |
qa: add rbd copy workunit
Test copying an image and snapshot.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'qa')
-rwxr-xr-x | qa/workunits/rbd/copy.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/qa/workunits/rbd/copy.sh b/qa/workunits/rbd/copy.sh new file mode 100755 index 00000000000..0186d8324c2 --- /dev/null +++ b/qa/workunits/rbd/copy.sh @@ -0,0 +1,41 @@ +#!/bin/sh -ex + +rbd rm testimg1 || true +rbd rm testimg2 || true +rbd rm testimg3 || true + +rm -f /tmp/img1 /tmp/img1.new +rm -f /tmp/img2 /tmp/img2.new +rm -f /tmp/img3 /tmp/img3.new + +# create an image +dd if=/bin/sh of=/tmp/img1 bs=1k count=1 seek=10 +dd if=/bin/dd of=/tmp/img1 bs=1k count=10 seek=100 +dd if=/bin/rm of=/tmp/img1 bs=1k count=100 seek=1000 +dd if=/bin/ls of=/tmp/img1 bs=1k seek=10000 +dd if=/bin/ln of=/tmp/img1 bs=1k seek=100000 + +# import, snapshot +rbd import /tmp/img1 testimg1 +rbd resize testimg1 --size=256 +rbd export testimg1 /tmp/img2 +rbd snap create testimg1 --snap=snap1 +rbd resize testimg1 --size=128 +rbd export testimg1 /tmp/img3 + +# make copies +rbd copy testimg1 --snap=snap1 testimg2 +rbd copy testimg1 testimg3 + +# verify the result +rbd info testimg2 | grep 'size 256 MB' +rbd info testimg3 | grep 'size 128 MB' + +rbd export testimg1 /tmp/img1.new +rbd export testimg2 /tmp/img2.new +rbd export testimg3 /tmp/img3.new + +cmp /tmp/img2 /tmp/img2.new +cmp /tmp/img3 /tmp/img3.new + +echo OK
\ No newline at end of file |