diff options
author | Sage Weil <sage@inktank.com> | 2013-03-26 13:32:28 -0700 |
---|---|---|
committer | Josh Durgin <josh.durgin@inktank.com> | 2013-03-31 23:32:40 -0700 |
commit | e7167433aef5e404fe05b525f7840f9e2c52501f (patch) | |
tree | 85dcae5ff58bc4d06276cfc3ae6af07ec75c0c09 /qa | |
parent | cf7d13a7e90ced80d1a9ad2d2130c310c3d418b5 (diff) | |
download | ceph-e7167433aef5e404fe05b525f7840f9e2c52501f.tar.gz |
rbd: implement 'export-diff' and 'import-diff' commands
Export a diff of an image from a previous snapshot to a file (or stdout).
Import a diff and apply it to an image, and then create the ending
snapshot.
Signed-off-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'qa')
-rwxr-xr-x | qa/workunits/rbd/diff.sh | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/qa/workunits/rbd/diff.sh b/qa/workunits/rbd/diff.sh new file mode 100755 index 00000000000..6f9cd27ae42 --- /dev/null +++ b/qa/workunits/rbd/diff.sh @@ -0,0 +1,43 @@ +#!/bin/bash -ex + +function cleanup() { + rbd snap purge foo || : + rbd rm foo || : + rbd snap purge foo.copy || : + rbd rm foo.copy || : + rm -f foo.diff foo.out +} + +cleanup + +rbd create foo --size 1000 +rbd bench-write foo --io-size 4096 --io-threads 5 --io-total 4096000 --io-pattern rand + +#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 +rbd bench-write foo --io-size 4096 --io-threads 5 --io-total 4096000 --io-pattern rand +rbd snap create foo --snap=three +rbd snap create foo.copy --snap=two + +rbd export-diff foo@three --from-snap two foo.diff +rbd import-diff foo.diff foo.copy +rbd snap ls foo.copy | grep three + +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 + |