2017-07-20 22:26:42 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -ex
|
2013-03-26 20:32:28 +00:00
|
|
|
|
|
|
|
function cleanup() {
|
|
|
|
rbd snap purge foo || :
|
|
|
|
rbd rm foo || :
|
|
|
|
rbd snap purge foo.copy || :
|
|
|
|
rbd rm foo.copy || :
|
2013-03-29 04:53:30 +00:00
|
|
|
rbd snap purge foo.copy2 || :
|
|
|
|
rbd rm foo.copy2 || :
|
2013-03-26 20:32:28 +00:00
|
|
|
rm -f foo.diff foo.out
|
|
|
|
}
|
|
|
|
|
|
|
|
cleanup
|
|
|
|
|
|
|
|
rbd create foo --size 1000
|
2019-01-28 12:24:54 +00:00
|
|
|
rbd bench --io-type write foo --io-size 4096 --io-threads 5 --io-total 4096000 --io-pattern rand
|
2013-03-26 20:32:28 +00:00
|
|
|
|
|
|
|
#rbd cp foo foo.copy
|
|
|
|
rbd create foo.copy --size 1000
|
|
|
|
rbd export-diff foo - | rbd import-diff - foo.copy
|
|
|
|
|
|
|
|
rbd snap create foo --snap=two
|
2019-01-28 12:24:54 +00:00
|
|
|
rbd bench --io-type write foo --io-size 4096 --io-threads 5 --io-total 4096000 --io-pattern rand
|
2013-03-26 20:32:28 +00:00
|
|
|
rbd snap create foo --snap=three
|
|
|
|
rbd snap create foo.copy --snap=two
|
|
|
|
|
2013-03-28 22:17:19 +00:00
|
|
|
rbd export-diff foo@two --from-snap three foo.diff && exit 1 || true # wrong snap order
|
2017-04-12 14:18:52 +00:00
|
|
|
rm -f foo.diff
|
2013-03-28 22:17:19 +00:00
|
|
|
|
2013-03-26 20:32:28 +00:00
|
|
|
rbd export-diff foo@three --from-snap two foo.diff
|
|
|
|
rbd import-diff foo.diff foo.copy
|
2013-03-29 04:29:55 +00:00
|
|
|
rbd import-diff foo.diff foo.copy && exit 1 || true # this should fail with EEXIST on the end snap
|
2013-03-26 20:32:28 +00:00
|
|
|
rbd snap ls foo.copy | grep three
|
|
|
|
|
2013-03-29 04:53:30 +00:00
|
|
|
rbd create foo.copy2 --size 1000
|
|
|
|
rbd import-diff foo.diff foo.copy2 && exit 1 || true # this should fail bc the start snap dne
|
|
|
|
|
2013-03-26 20:32:28 +00:00
|
|
|
rbd export foo foo.out
|
|
|
|
orig=`md5sum foo.out | awk '{print $1}'`
|
|
|
|
rm foo.out
|
|
|
|
rbd export foo.copy foo.out
|
|
|
|
copy=`md5sum foo.out | awk '{print $1}'`
|
|
|
|
|
|
|
|
if [ "$orig" != "$copy" ]; then
|
|
|
|
echo does not match
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cleanup
|
|
|
|
|
|
|
|
echo OK
|
|
|
|
|