[sheepdog] [PATCH 2/3] tests/functional: add a test for deep copied snapshots

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Mon Jan 19 02:51:44 CET 2015


Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 tests/functional/100     | 50 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/functional/100.out | 39 +++++++++++++++++++++++++++++++++++++
 tests/functional/group   |  1 +
 3 files changed, 90 insertions(+)
 create mode 100755 tests/functional/100
 create mode 100644 tests/functional/100.out

diff --git a/tests/functional/100 b/tests/functional/100
new file mode 100755
index 0000000..012832a
--- /dev/null
+++ b/tests/functional/100
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+# Test deepcopy snapshot
+
+. ./common
+
+for i in 0 1 2; do
+    _start_sheep $i
+done
+_wait_for_sheep 3
+_cluster_format -c 2
+
+$DOG vdi create test 16M -P
+$DOG vdi snapshot test
+$DOG vdi clone test -s 1 test_cloned
+
+$DOG vdi write test_cloned 0 512 < /dev/zero
+$DOG vdi write test_cloned $((4 * 1024 ** 2 * 1)) 512 < /dev/zero
+_node_info
+
+_vdi_list
+
+echo creating deep copied snapshot and its clone
+$DOG vdi snapshot test --no-share     # deep copy snapshot
+$DOG vdi snapshot test
+$DOG vdi clone test -s 3 test_cloned2
+
+$DOG vdi write test_cloned2 0 512 < /dev/zero
+$DOG vdi write test_cloned2 $((4 * 1024 ** 2 * 1)) 512 < /dev/zero
+_node_info
+
+_vdi_list
+
+echo deleting original VDI tree
+$DOG vdi delete test -s 1
+$DOG vdi delete test -s 2
+$DOG vdi delete test_cloned
+_node_info
+_vdi_list
+
+echo deleting deep copied snapshot and its clone
+$DOG vdi delete test
+$DOG vdi delete test -s 3
+$DOG vdi delete test_cloned2
+
+echo there should be no object
+_node_info
+
+echo there should be no vdi
+_vdi_list
diff --git a/tests/functional/100.out b/tests/functional/100.out
new file mode 100644
index 0000000..9f1c6f3
--- /dev/null
+++ b/tests/functional/100.out
@@ -0,0 +1,39 @@
+QA output created by 100
+using backend plain store
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	5	1	0	0	2	0
+1	4	2	0	0	0	0
+2	3	3	0	0	2	0
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag   Block Size Shift
+c test_cloned     0   16 MB  8.0 MB  8.0 MB DATE   34f19d      2                22
+s test         1   16 MB   16 MB  0.0 MB DATE   7c2b25      2                22
+  test         0   16 MB  0.0 MB   16 MB DATE   7c2b26      2                22
+creating deep copied snapshot and its clone
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	9	3	0	0	6	0
+1	9	4	0	0	3	0
+2	6	5	0	0	3	0
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag   Block Size Shift
+c test_cloned     0   16 MB  8.0 MB  8.0 MB DATE   34f19d      2                22
+s test         1   16 MB   16 MB  0.0 MB DATE   7c2b25      2                22
+s test         2   16 MB  0.0 MB   16 MB DATE   7c2b26      2                22
+s test         3   16 MB   16 MB  0.0 MB DATE   7c2b27      2                22
+  test         0   16 MB  0.0 MB   16 MB DATE   7c2b28      2                22
+c test_cloned2     0   16 MB  8.0 MB  8.0 MB DATE   f6ac5d      2                22
+deleting original VDI tree
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	4	2	0	0	2	0
+1	5	2	0	0	1	0
+2	3	2	0	0	1	0
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag   Block Size Shift
+s test         3   16 MB   16 MB  0.0 MB DATE   7c2b27      2                22
+  test         0   16 MB  0.0 MB   16 MB DATE   7c2b28      2                22
+c test_cloned2     0   16 MB  8.0 MB  8.0 MB DATE   f6ac5d      2                22
+deleting deep copied snapshot and its clone
+there should be no object
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	0	0	0	0	0	0
+1	0	0	0	0	0	0
+2	0	0	0	0	0	0
+there should be no vdi
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag   Block Size Shift
diff --git a/tests/functional/group b/tests/functional/group
index 15edbf7..2e03738 100644
--- a/tests/functional/group
+++ b/tests/functional/group
@@ -114,3 +114,4 @@
 097 vdi cluster
 098 auto quick vdi cluster
 099 auto quick vdi cluster
+100 auto quick vdi
-- 
1.9.1




More information about the sheepdog mailing list