[sheepdog] [PATCH v10 18/19] tests/functional: add a new test of the object reclaim for cloned VDIs

Hitoshi Mitake mitake.hitoshi at gmail.com
Mon Jun 2 17:09:12 CEST 2014


From: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>

This patch adds a new test of the object reclaim algorithm. The test
creates branch of VDI tree and checks the GC works well for the case.

Cc: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
Tested-by: Valerio Pachera <sirio81 at gmail.com>
Cc: Alessandro Bolgia <alessandro at extensys.it>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 tests/functional/092     | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/functional/092.out | 42 ++++++++++++++++++++++++++++++++++++++++++
 tests/functional/group   |  1 +
 3 files changed, 90 insertions(+)
 create mode 100755 tests/functional/092
 create mode 100644 tests/functional/092.out

diff --git a/tests/functional/092 b/tests/functional/092
new file mode 100755
index 0000000..6f0377d
--- /dev/null
+++ b/tests/functional/092
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+# Test object reclaim for cloned VDIs
+
+. ./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
+_node_info
+
+$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
+
+$DOG vdi clone test -s 1 test_cloned2 # create branch
+
+$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
+
+$DOG vdi delete test
+_node_info
+
+$DOG vdi delete test -s 1
+_node_info
+
+$DOG vdi delete test_cloned
+_node_info
+
+$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/092.out b/tests/functional/092.out
new file mode 100644
index 0000000..a3e5f4b
--- /dev/null
+++ b/tests/functional/092.out
@@ -0,0 +1,42 @@
+QA output created by 092
+using backend plain store
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	3	0	0	0	0	0
+1	3	1	0	0	0	0
+2	2	1	0	0	0	0
+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
+c test_cloned     0   16 MB  8.0 MB  8.0 MB DATE   34f19d      2              
+s test         1   16 MB   16 MB  0.0 MB DATE   7c2b25      2              
+  test         0   16 MB  0.0 MB   16 MB DATE   7c2b26      2              
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	5	2	0	0	2	0
+1	6	3	0	0	0	0
+2	5	3	0	0	2	0
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+c test_cloned     0   16 MB  8.0 MB  8.0 MB DATE   34f19d      2              
+s test         1   16 MB   16 MB  0.0 MB DATE   7c2b25      2              
+  test         0   16 MB  0.0 MB   16 MB DATE   7c2b26      2              
+c test_cloned2     0   16 MB  8.0 MB  8.0 MB DATE   f6ac5d      2              
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	5	2	0	0	4	0
+1	6	3	0	0	2	0
+2	5	3	0	0	2	0
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	3	2	0	0	2	0
+1	4	3	0	0	2	0
+2	5	3	0	0	0	0
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	1	2	0	0	2	0
+1	3	3	0	0	2	0
+2	4	3	0	0	0	0
+there should be no object
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	0	2	0	0	0	0
+1	0	3	0	0	0	0
+2	0	3	0	0	0	0
+there should be no vdi
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
diff --git a/tests/functional/group b/tests/functional/group
index 9a7785e..d69f2d7 100644
--- a/tests/functional/group
+++ b/tests/functional/group
@@ -106,3 +106,4 @@
 089 auto quick sheepfs
 090 auto quick vdi md
 091 auto quick cluster md
+092 auto quick vdi
-- 
1.9.1




More information about the sheepdog mailing list