summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-03-26 13:32:28 -0700
committerJosh Durgin <josh.durgin@inktank.com>2013-03-31 23:32:40 -0700
commite7167433aef5e404fe05b525f7840f9e2c52501f (patch)
tree85dcae5ff58bc4d06276cfc3ae6af07ec75c0c09 /qa
parentcf7d13a7e90ced80d1a9ad2d2130c310c3d418b5 (diff)
downloadceph-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-xqa/workunits/rbd/diff.sh43
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
+