[sheepdog] [PATCH stable-0.6 03/22] tests: count the number of objects instead of using node/md info
Hitoshi Mitake
mitake.hitoshi at gmail.com
Mon Aug 12 16:55:07 CEST 2013
From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
This introduces helpers _node_info() and _md_info() to count all the
objects in the store dictory. By using this function instead of
'collie node info' and 'collie node md info', we can get the unique
output in spite of the underlying filesystem.
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
tests/016 | 2 +-
tests/016.out | 11 +++----
tests/042 | 2 +-
tests/042.out | 37 +++--------------------
tests/044 | 2 +-
tests/044.out | 11 +++----
tests/057 | 10 +++---
tests/057.out | 94 ++++++++++++++++++++++++++++++++++++++++++---------------
tests/058 | 4 +--
tests/058.out | 22 +++++---------
tests/063 | 4 +--
tests/063.out | 31 +++++++++----------
tests/064 | 8 ++---
tests/064.out | 47 ++++++++++++-----------------
tests/common.rc | 50 ++++++++++++++++++++++++++++++
15 files changed, 191 insertions(+), 144 deletions(-)
diff --git a/tests/016 b/tests/016
index 52a8bb8..c10d9e1 100755
--- a/tests/016
+++ b/tests/016
@@ -45,4 +45,4 @@ echo there should be no vdi
$COLLIE vdi list
echo there should be no object
-$COLLIE node info | _filter_node_info
+_node_info
diff --git a/tests/016.out b/tests/016.out
index 88c5afd..56cf2f8 100644
--- a/tests/016.out
+++ b/tests/016.out
@@ -3,10 +3,7 @@ using backend plain store
there should be no vdi
Name Id Size Used Shared Creation time VDI id Copies Tag
there should be no object
-Id Size Used Avail Use%
-0 MASKED GB 12 MB MASKED GB MASTERD
-1 MASKED GB 12 MB MASKED GB MASTERD
-2 MASKED GB 12 MB MASKED GB MASTERD
-Total MASKED GB 36 MB MASKED GB MASTERD
-
-Total virtual image size 0.0 MB
+STORE DATA VDI VMSTATE ATTR STALE
+0 0 3 0 0 0
+1 0 3 0 0 0
+2 0 3 0 0 0
diff --git a/tests/042 b/tests/042
index 46f1a07..9680985 100755
--- a/tests/042
+++ b/tests/042
@@ -54,7 +54,7 @@ $COLLIE vdi create test2 100M -p 7000
$COLLIE vdi create test3 100M -p 7002
for i in `seq 0 3`; do
- $COLLIE node info -p 700$i | _filter_node_info
$COLLIE node list -p 700$i
done
+_node_info
ls $STORE/*/obj/* | _filter_store | sort
diff --git a/tests/042.out b/tests/042.out
index a51153f..2449d2f 100644
--- a/tests/042.out
+++ b/tests/042.out
@@ -46,58 +46,31 @@ Failed to write object fd32fc0000000a: Server has no space for new objects
Failed to write VDI
Failed to create VDI test2: Failed to write to requested VDI
Failed to create VDI test3: Failed to write to requested VDI
-Id Size Used Avail Use%
-0 MASKED MB 104 MB MASKED MB MASTERD
-1 MASKED MB 104 MB MASKED MB MASTERD
-2 MASKED MB 4.0 MB MASKED MB MASTERD
-3 MASKED MB 4.0 MB MASKED MB MASTERD
-Total MASKED GB 216 MB MASKED GB MASTERD
-
-Total virtual image size 200 MB
M Id Host:Port V-Nodes Zone
- 0 127.0.0.1:7000 126 0
- 1 127.0.0.1:7001 126 1
- 2 127.0.0.1:7002 2 2
- 3 127.0.0.1:7003 2 3
-Id Size Used Avail Use%
-0 MASKED MB 104 MB MASKED MB MASTERD
-1 MASKED MB 104 MB MASKED MB MASTERD
-2 MASKED MB 4.0 MB MASKED MB MASTERD
-3 MASKED MB 4.0 MB MASKED MB MASTERD
-Total MASKED GB 216 MB MASKED GB MASTERD
-
-Total virtual image size 200 MB
M Id Host:Port V-Nodes Zone
- 0 127.0.0.1:7000 126 0
- 1 127.0.0.1:7001 126 1
- 2 127.0.0.1:7002 2 2
- 3 127.0.0.1:7003 2 3
-Id Size Used Avail Use%
-0 MASKED MB 104 MB MASKED MB MASTERD
-1 MASKED MB 104 MB MASKED MB MASTERD
-2 MASKED MB 4.0 MB MASKED MB MASTERD
-3 MASKED MB 4.0 MB MASKED MB MASTERD
-Total MASKED GB 216 MB MASKED GB MASTERD
-
-Total virtual image size 200 MB
M Id Host:Port V-Nodes Zone
- 0 127.0.0.1:7000 126 0
- 1 127.0.0.1:7001 126 1
- 2 127.0.0.1:7002 2 2
- 3 127.0.0.1:7003 2 3
-Id Size Used Avail Use%
-0 MASKED MB 104 MB MASKED MB MASTERD
-1 MASKED MB 104 MB MASKED MB MASTERD
-2 MASKED MB 4.0 MB MASKED MB MASTERD
-3 MASKED MB 4.0 MB MASKED MB MASTERD
-Total MASKED GB 216 MB MASKED GB MASTERD
-
-Total virtual image size 200 MB
M Id Host:Port V-Nodes Zone
- 0 127.0.0.1:7000 126 0
- 1 127.0.0.1:7001 126 1
- 2 127.0.0.1:7002 2 2
- 3 127.0.0.1:7003 2 3
+STORE DATA VDI VMSTATE ATTR STALE
+0 22 4 0 0 0
+1 22 4 0 0 0
+2 0 1 0 0 0
+3 0 1 0 0 0
STORE/0/obj/00fd32fc00000000
STORE/0/obj/00fd32fc00000001
STORE/0/obj/00fd32fc00000002
diff --git a/tests/044 b/tests/044
index c823ed5..6dcf099 100755
--- a/tests/044
+++ b/tests/044
@@ -80,6 +80,6 @@ echo there should be no vdi
$COLLIE vdi list
echo there should be no object
-$COLLIE node info | _filter_node_info
+_node_info
find $STORE/*/cache -type f | sort
diff --git a/tests/044.out b/tests/044.out
index f1b0106..7fa9e17 100644
--- a/tests/044.out
+++ b/tests/044.out
@@ -3,10 +3,7 @@ using backend plain store
there should be no vdi
Name Id Size Used Shared Creation time VDI id Copies Tag
there should be no object
-Id Size Used Avail Use%
-0 MASKED GB 144 MB MASKED GB MASTERD
-1 MASKED GB 144 MB MASKED GB MASTERD
-2 MASKED GB 144 MB MASKED GB MASTERD
-Total MASKED GB 433 MB MASKED GB MASTERD
-
-Total virtual image size 0.0 MB
+STORE DATA VDI VMSTATE ATTR STALE
+0 0 36 0 0 0
+1 0 36 0 0 0
+2 0 36 0 0 0
diff --git a/tests/057 b/tests/057
index 4241f59..643c27a 100755
--- a/tests/057
+++ b/tests/057
@@ -27,33 +27,33 @@ $COLLIE cluster format
sleep 1
$COLLIE vdi create test 100M -P
-$COLLIE node md info | _filter_md_info
+_md_info
# plug during node event
_start_sheep 3
_wait_for_sheep 4
$COLLIE node md plug $STORE/0/d3,$STORE/0/d4
_wait_for_sheep_recovery 0
-$COLLIE node md info | _filter_md_info
+_md_info
$COLLIE vdi check test
$COLLIE cluster info | _filter_cluster_info
# plug duplicate path
$COLLIE node md plug $STORE/0/d3
$COLLIE node recovery
-$COLLIE node md info | _filter_md_info
+_md_info
# unplug
$COLLIE node md unplug $STORE/0/d0,$STORE/0/d1
_wait_for_sheep_recovery 0
-$COLLIE node md info | _filter_md_info
+_md_info
$COLLIE vdi check test
$COLLIE cluster info | _filter_cluster_info
# unplug invalid path
$COLLIE node md unplug $STORE/0/d0
$COLLIE node recovery
-$COLLIE node md info | _filter_md_info
+_md_info
$COLLIE cluster info | _filter_cluster_info
# check stale object purging
diff --git a/tests/057.out b/tests/057.out
index 150a845..05d8ba9 100644
--- a/tests/057.out
+++ b/tests/057.out
@@ -1,15 +1,30 @@
QA output created by 057
using backend plain store
-Id Size Used Avail Use% Path
-0 MASKED GB 32 MB MASKED GB MASTERD STORE/0/d0
-1 MASKED GB 32 MB MASKED GB MASTERD STORE/0/d1
-2 MASKED GB 40 MB MASKED GB MASTERD STORE/0/d2
-Id Size Used Avail Use% Path
-0 MASKED GB 4.0 MB MASKED GB MASTERD STORE/0/d0
-1 MASKED GB 20 MB MASKED GB MASTERD STORE/0/d1
-2 MASKED GB 28 MB MASKED GB MASTERD STORE/0/d2
-3 MASKED GB 20 MB MASKED GB MASTERD STORE/0/d3
-4 MASKED GB 24 MB MASKED GB MASTERD STORE/0/d4
+STORE DATA VDI VMSTATE ATTR STALE
+0/d0 8 0 0 0 0
+0/d1 8 0 0 0 0
+0/d2 9 1 0 0 0
+1/d0 8 0 0 0 0
+1/d1 12 0 0 0 0
+1/d2 5 1 0 0 0
+2/d0 10 1 0 0 0
+2/d1 8 0 0 0 0
+2/d2 7 0 0 0 0
+STORE DATA VDI VMSTATE ATTR STALE
+0/d0 1 0 0 0 0
+0/d1 5 0 0 0 0
+0/d2 7 0 0 0 0
+0/d3 5 0 0 0 0
+0/d4 5 1 0 0 0
+1/d0 4 0 0 0 0
+1/d1 4 0 0 0 0
+1/d2 5 1 0 0 0
+2/d0 8 1 0 0 0
+2/d1 5 0 0 0 0
+2/d2 6 0 0 0 0
+3/d0 9 0 0 0 0
+3/d1 2 0 0 0 0
+3/d2 9 0 0 0 0
finish check&repair test
Cluster status: running, auto-recovery enabled
@@ -21,16 +36,36 @@ DATE 1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002]
Failed to execute request, look for sheep.log for more information
Nodes In Recovery:
Id Host:Port V-Nodes Zone
-Id Size Used Avail Use% Path
-0 MASKED GB 4.0 MB MASKED GB MASTERD STORE/0/d0
-1 MASKED GB 20 MB MASKED GB MASTERD STORE/0/d1
-2 MASKED GB 28 MB MASKED GB MASTERD STORE/0/d2
-3 MASKED GB 20 MB MASKED GB MASTERD STORE/0/d3
-4 MASKED GB 24 MB MASKED GB MASTERD STORE/0/d4
-Id Size Used Avail Use% Path
-0 MASKED GB 28 MB MASKED GB MASTERD STORE/0/d2
-1 MASKED GB 32 MB MASKED GB MASTERD STORE/0/d3
-2 MASKED GB 36 MB MASKED GB MASTERD STORE/0/d4
+STORE DATA VDI VMSTATE ATTR STALE
+0/d0 1 0 0 0 0
+0/d1 5 0 0 0 0
+0/d2 7 0 0 0 0
+0/d3 5 0 0 0 0
+0/d4 5 1 0 0 0
+1/d0 4 0 0 0 0
+1/d1 4 0 0 0 0
+1/d2 5 1 0 0 0
+2/d0 8 1 0 0 0
+2/d1 5 0 0 0 0
+2/d2 6 0 0 0 0
+3/d0 9 0 0 0 0
+3/d1 2 0 0 0 0
+3/d2 9 0 0 0 0
+STORE DATA VDI VMSTATE ATTR STALE
+0/d0 1 0 0 0 0
+0/d1 5 0 0 0 0
+0/d2 7 0 0 0 0
+0/d3 8 0 0 0 0
+0/d4 8 1 0 0 0
+1/d0 4 0 0 0 0
+1/d1 4 0 0 0 0
+1/d2 5 1 0 0 0
+2/d0 8 1 0 0 0
+2/d1 5 0 0 0 0
+2/d2 6 0 0 0 0
+3/d0 9 0 0 0 0
+3/d1 2 0 0 0 0
+3/d2 9 0 0 0 0
finish check&repair test
Cluster status: running, auto-recovery enabled
@@ -42,10 +77,21 @@ DATE 1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002]
Failed to execute request, look for sheep.log for more information
Nodes In Recovery:
Id Host:Port V-Nodes Zone
-Id Size Used Avail Use% Path
-0 MASKED GB 28 MB MASKED GB MASTERD STORE/0/d2
-1 MASKED GB 32 MB MASKED GB MASTERD STORE/0/d3
-2 MASKED GB 36 MB MASKED GB MASTERD STORE/0/d4
+STORE DATA VDI VMSTATE ATTR STALE
+0/d0 1 0 0 0 0
+0/d1 5 0 0 0 0
+0/d2 7 0 0 0 0
+0/d3 8 0 0 0 0
+0/d4 8 1 0 0 0
+1/d0 4 0 0 0 0
+1/d1 4 0 0 0 0
+1/d2 5 1 0 0 0
+2/d0 8 1 0 0 0
+2/d1 5 0 0 0 0
+2/d2 6 0 0 0 0
+3/d0 9 0 0 0 0
+3/d1 2 0 0 0 0
+3/d2 9 0 0 0 0
Cluster status: running, auto-recovery enabled
Cluster created at DATE
diff --git a/tests/058 b/tests/058
index 5c47fbc..bda659c 100755
--- a/tests/058
+++ b/tests/058
@@ -21,10 +21,10 @@ _wait_for_sheep 3
$COLLIE cluster format
sleep 1
$COLLIE vdi create test 100M -P
-$COLLIE node info | _filter_node_info
+_node_info
qemu-io -c "discard 0 100m" sheepdog:test | _filter_qemu_io
$COLLIE vdi check test
for i in `seq 0 24`; do
$COLLIE vdi object test -i $i;
done
-$COLLIE node info | _filter_node_info
+_node_info
diff --git a/tests/058.out b/tests/058.out
index 75cc1ee..758a027 100644
--- a/tests/058.out
+++ b/tests/058.out
@@ -1,12 +1,9 @@
QA output created by 058
using backend plain store
-Id Size Used Avail Use%
-0 MASKED GB 104 MB MASKED GB MASTERD
-1 MASKED GB 104 MB MASKED GB MASTERD
-2 MASKED GB 104 MB MASKED GB MASTERD
-Total MASKED GB 312 MB MASKED GB MASTERD
-
-Total virtual image size 100 MB
+STORE DATA VDI VMSTATE ATTR STALE
+0 25 1 0 0 0
+1 25 1 0 0 0
+2 25 1 0 0 0
discard 104857600/104857600 bytes at offset 0
100 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
finish check&repair test
@@ -35,10 +32,7 @@ The inode object 0x7c2b25 idx 21 is not allocated
The inode object 0x7c2b25 idx 22 is not allocated
The inode object 0x7c2b25 idx 23 is not allocated
The inode object 0x7c2b25 idx 24 is not allocated
-Id Size Used Avail Use%
-0 MASKED GB 4.0 MB MASKED GB MASTERD
-1 MASKED GB 4.0 MB MASKED GB MASTERD
-2 MASKED GB 4.0 MB MASKED GB MASTERD
-Total MASKED GB 12 MB MASKED GB MASTERD
-
-Total virtual image size 100 MB
+STORE DATA VDI VMSTATE ATTR STALE
+0 0 1 0 0 0
+1 0 1 0 0 0
+2 0 1 0 0 0
diff --git a/tests/063 b/tests/063
index cd9b385..deec2d5 100755
--- a/tests/063
+++ b/tests/063
@@ -33,7 +33,7 @@ $COLLIE cluster format -c 1
sleep 1
$COLLIE vdi create test 200M -P
-$COLLIE node info
+_node_info
$COLLIE node list
$COLLIE node md plug $STORE/4
@@ -43,6 +43,6 @@ $COLLIE cluster reweight
_start_sheep 5
_wait_for_sheep 5
_wait_for_sheep_recovery 0
-$COLLIE node info
+_node_info
$COLLIE node list
$COLLIE cluster info | _filter_cluster_info
diff --git a/tests/063.out b/tests/063.out
index b21f220..194d523 100644
--- a/tests/063.out
+++ b/tests/063.out
@@ -1,27 +1,24 @@
QA output created by 063
using backend plain store
-Id Size Used Avail Use%
- 0 95 MB 76 MB 19 MB 79%
- 1 95 MB 56 MB 39 MB 58%
- 2 95 MB 72 MB 23 MB 75%
- 3 0.0 MB 0.0 MB 0.0 MB 0%
-Total 286 MB 204 MB 82 MB 71%
-
-Total virtual image size 200 MB
+STORE DATA VDI VMSTATE ATTR STALE
+0 19 0 0 0 0
+1 13 1 0 0 0
+2 18 0 0 0 0
+3 0 0 0 0 0
+4 0 0 0 0 0
+5 0 0 0 0 0
M Id Host:Port V-Nodes Zone
- 0 127.0.0.1:7000 64 0
- 1 127.0.0.1:7001 64 1
- 2 127.0.0.1:7002 64 2
- 3 127.0.0.1:7003 0 3
-Id Size Used Avail Use%
- 0 190 MB 68 MB 122 MB 35%
- 1 95 MB 56 MB 39 MB 58%
- 2 95 MB 36 MB 59 MB 37%
- 3 0.0 MB 0.0 MB 0.0 MB 0%
- 4 95 MB 44 MB 51 MB 46%
-Total 476 MB 204 MB 272 MB 42%
-
-Total virtual image size 200 MB
+STORE DATA VDI VMSTATE ATTR STALE
+0 9 0 0 0 0
+1 13 1 0 0 0
+2 9 0 0 0 0
+3 0 0 0 0 0
+4 8 0 0 0 0
+5 11 0 0 0 0
M Id Host:Port V-Nodes Zone
- 0 127.0.0.1:7000 102 0
- 1 127.0.0.1:7001 51 1
diff --git a/tests/064 b/tests/064
index 68f5c6b..64edd8e 100755
--- a/tests/064
+++ b/tests/064
@@ -30,12 +30,12 @@ $COLLIE cluster format -c 2
sleep 1
$COLLIE vdi create test 100M -P
-$COLLIE node info
+_node_info
$COLLIE node list
$COLLIE node md plug $STORE/3
_wait_for_sheep_recovery 0
-$COLLIE node info
+_node_info
$COLLIE node list
$COLLIE cluster reweight
@@ -43,11 +43,11 @@ $COLLIE cluster reweight
# restart sheep1 while reweighting
_kill_sheep 2
_wait_for_sheep_recovery 0
-$COLLIE node info
+_node_info
$COLLIE node list
_start_sheep 2
_wait_for_sheep_recovery 0
-$COLLIE node info
+_node_info
$COLLIE node list
$COLLIE cluster info | _filter_cluster_info
diff --git a/tests/064.out b/tests/064.out
index b22a058..73346cc 100644
--- a/tests/064.out
+++ b/tests/064.out
@@ -1,43 +1,36 @@
QA output created by 064
using backend plain store
-Id Size Used Avail Use%
- 0 192 MB 72 MB 120 MB 37%
- 1 192 MB 52 MB 140 MB 27%
- 2 385 MB 84 MB 301 MB 21%
-Total 769 MB 208 MB 561 MB 27%
-
-Total virtual image size 100 MB
+STORE DATA VDI VMSTATE ATTR STALE
+0 17 1 0 0 0
+1 12 1 0 0 0
+2 21 0 0 0 0
+3 0 0 0 0 0
M Id Host:Port V-Nodes Zone
- 0 127.0.0.1:7000 48 0
- 1 127.0.0.1:7001 48 1
- 2 127.0.0.1:7002 96 2
-Id Size Used Avail Use%
- 0 384 MB 72 MB 312 MB 18%
- 1 192 MB 52 MB 140 MB 27%
- 2 385 MB 84 MB 301 MB 21%
-Total 961 MB 208 MB 753 MB 21%
-
-Total virtual image size 100 MB
+STORE DATA VDI VMSTATE ATTR STALE
+0 8 1 0 0 0
+1 12 1 0 0 0
+2 21 0 0 0 0
+3 9 0 0 0 0
M Id Host:Port V-Nodes Zone
- 0 127.0.0.1:7000 48 0
- 1 127.0.0.1:7001 48 1
- 2 127.0.0.1:7002 96 2
-Id Size Used Avail Use%
- 0 384 MB 104 MB 280 MB 27%
- 1 192 MB 104 MB 88 MB 54%
-Total 576 MB 208 MB 368 MB 36%
-
-Total virtual image size 100 MB
+STORE DATA VDI VMSTATE ATTR STALE
+0 11 1 0 0 0
+1 25 1 0 0 0
+2 18 0 0 0 3
+3 14 0 0 0 0
M Id Host:Port V-Nodes Zone
- 0 127.0.0.1:7000 85 0
- 1 127.0.0.1:7001 43 1
-Id Size Used Avail Use%
- 0 384 MB 88 MB 296 MB 22%
- 1 192 MB 44 MB 148 MB 22%
- 2 385 MB 76 MB 309 MB 19%
-Total 961 MB 208 MB 753 MB 21%
-
-Total virtual image size 100 MB
+STORE DATA VDI VMSTATE ATTR STALE
+0 9 1 0 0 0
+1 10 1 0 0 0
+2 19 0 0 0 0
+3 12 0 0 0 0
M Id Host:Port V-Nodes Zone
- 0 127.0.0.1:7000 77 0
- 1 127.0.0.1:7001 38 1
diff --git a/tests/common.rc b/tests/common.rc
index 9ffde77..85a02f9 100644
--- a/tests/common.rc
+++ b/tests/common.rc
@@ -383,6 +383,56 @@ _cleanup_devices()
done
}
+_list_data_obj()
+{
+ find $STORE/$1 | grep -E /0[0-9a-f]\{15\} | grep -v .stale
+}
+
+_list_vdi_obj()
+{
+ find $STORE/$1 | grep -E /8[0-9a-f]\{15\} | grep -v .stale
+}
+
+_list_vmstate_obj()
+{
+ find $STORE/$1 | grep -E /4[0-9a-f]\{15\} | grep -v .stale
+}
+
+_list_attr_obj()
+{
+ find $STORE/$1 | grep -E /2[0-9a-f]\{15\} | grep -v .stale
+}
+
+_list_stale_obj()
+{
+ find $STORE/$1 | grep -E /[0-9a-f]\{16\} | grep .stale
+}
+
+_stat_store()
+{
+ local pattern=$1
+ local idx
+ echo -e "STORE\tDATA\tVDI\tVMSTATE\tATTR\tSTALE"
+ for idx in `ls -d $STORE/$pattern | sed s#$STORE/##g`; do
+ local data_obj=$(_list_data_obj $idx | wc -l)
+ local vdi_obj=$(_list_vdi_obj $idx | wc -l)
+ local vmstate_obj=$(_list_vmstate_obj $idx | wc -l)
+ local attr_obj=$(_list_attr_obj $idx | wc -l)
+ local stale_obj=$(_list_stale_obj $idx | wc -l)
+ echo -e "$idx\t$data_obj\t$vdi_obj\t$vmstate_obj\t$attr_obj\t$stale_obj"
+ done
+}
+
+_node_info()
+{
+ _stat_store '?'
+}
+
+_md_info()
+{
+ _stat_store '?/d?'
+}
+
_random()
{
openssl enc -aes-128-cbc -pass pass:"$(date)" -nosalt < /dev/zero 2>/dev/null
--
1.8.1.2
More information about the sheepdog
mailing list