[sheepdog] [PATCH v2 2/2] tests/functional: add test for qemu reconnection
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Thu Jul 25 10:40:05 CEST 2013
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
tests/functional/071 | 89 +++++++++++++++++++++++++++
tests/functional/071.out | 136 +++++++++++++++++++++++++++++++++++++++++
tests/functional/072 | 60 ++++++++++++++++++
tests/functional/072.out | 32 ++++++++++
tests/functional/common.filter | 3 +-
tests/functional/common.rc | 1 +
tests/functional/group | 2 +
7 files changed, 322 insertions(+), 1 deletion(-)
create mode 100755 tests/functional/071
create mode 100644 tests/functional/071.out
create mode 100755 tests/functional/072
create mode 100644 tests/functional/072.out
diff --git a/tests/functional/071 b/tests/functional/071
new file mode 100755
index 0000000..16f4a77
--- /dev/null
+++ b/tests/functional/071
@@ -0,0 +1,89 @@
+#!/bin/bash
+
+# Test qemu reconnection while qemu I/O is ongoing
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1 # failure is the default!
+
+trap "_uninit; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+_need_to_be_root
+
+_uninit()
+{
+ _cleanup_machine_simulation 0 2> /dev/null
+}
+
+_cleanup
+
+for i in `seq 0 2`; do
+ _start_sheep $i
+done
+
+_wait_for_sheep 3
+
+_cluster_format -c 2
+
+$COLLIE vdi create test 128M
+
+_reboot_sheep()
+{
+ sleep 1
+ _simulate_machine_down $1
+ sleep 1
+ _cleanup_machine_simulation $1
+ sleep 1
+ _start_sheep $1
+ _wait_for_sheep 3
+}
+
+obj_size=$((4 * 1024 ** 2))
+
+echo reconnection while qemu-io write
+for i in `seq 0 3`; do
+ cmd=()
+ for j in `seq 0 7`; do
+ idx=$(($i * 8 + $j))
+ offset=$(($idx * $obj_size))
+ cmd=("${cmd[@]}" -c "write -P $idx $offset $obj_size")
+ done
+ qemu-io "${cmd[@]}" sheepdog:test 2> /dev/null | _filter_qemu_io &
+done | sort &
+_reboot_sheep 0
+wait
+
+echo reconnection while qemu-io read
+for i in `seq 0 3`; do
+ cmd=()
+ for j in `seq 0 7`; do
+ idx=$(($i * 8 + $j))
+ offset=$(($idx * $obj_size))
+ cmd=("${cmd[@]}" -c "read -P $idx $offset $obj_size")
+ done
+ qemu-io "${cmd[@]}" sheepdog:test 2> /dev/null | _filter_qemu_io &
+done | sort &
+_reboot_sheep 0
+wait
+
+$COLLIE vdi read test | md5sum
+
+echo reconnection while qemu-img read
+qemu-img convert sheepdog:test $STORE/tmp.img 2> /dev/null &
+_reboot_sheep 0
+wait
+
+echo reconnection while qemu-img write
+qemu-img convert $STORE/tmp.img sheepdog:test2 2> /dev/null &
+_reboot_sheep 0
+wait
+
+$COLLIE vdi read test2 | md5sum
+status=0
diff --git a/tests/functional/071.out b/tests/functional/071.out
new file mode 100644
index 0000000..a1f0edd
--- /dev/null
+++ b/tests/functional/071.out
@@ -0,0 +1,136 @@
+QA output created by 071
+using backend plain store
+reconnection while qemu-io write
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 4194304/4194304 bytes at offset 0
+wrote 4194304/4194304 bytes at offset 100663296
+wrote 4194304/4194304 bytes at offset 104857600
+wrote 4194304/4194304 bytes at offset 109051904
+wrote 4194304/4194304 bytes at offset 113246208
+wrote 4194304/4194304 bytes at offset 117440512
+wrote 4194304/4194304 bytes at offset 121634816
+wrote 4194304/4194304 bytes at offset 12582912
+wrote 4194304/4194304 bytes at offset 125829120
+wrote 4194304/4194304 bytes at offset 130023424
+wrote 4194304/4194304 bytes at offset 16777216
+wrote 4194304/4194304 bytes at offset 20971520
+wrote 4194304/4194304 bytes at offset 25165824
+wrote 4194304/4194304 bytes at offset 29360128
+wrote 4194304/4194304 bytes at offset 33554432
+wrote 4194304/4194304 bytes at offset 37748736
+wrote 4194304/4194304 bytes at offset 4194304
+wrote 4194304/4194304 bytes at offset 41943040
+wrote 4194304/4194304 bytes at offset 46137344
+wrote 4194304/4194304 bytes at offset 50331648
+wrote 4194304/4194304 bytes at offset 54525952
+wrote 4194304/4194304 bytes at offset 58720256
+wrote 4194304/4194304 bytes at offset 62914560
+wrote 4194304/4194304 bytes at offset 67108864
+wrote 4194304/4194304 bytes at offset 71303168
+wrote 4194304/4194304 bytes at offset 75497472
+wrote 4194304/4194304 bytes at offset 79691776
+wrote 4194304/4194304 bytes at offset 8388608
+wrote 4194304/4194304 bytes at offset 83886080
+wrote 4194304/4194304 bytes at offset 88080384
+wrote 4194304/4194304 bytes at offset 92274688
+wrote 4194304/4194304 bytes at offset 96468992
+reconnection while qemu-io read
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 4194304/4194304 bytes at offset 0
+read 4194304/4194304 bytes at offset 100663296
+read 4194304/4194304 bytes at offset 104857600
+read 4194304/4194304 bytes at offset 109051904
+read 4194304/4194304 bytes at offset 113246208
+read 4194304/4194304 bytes at offset 117440512
+read 4194304/4194304 bytes at offset 121634816
+read 4194304/4194304 bytes at offset 12582912
+read 4194304/4194304 bytes at offset 125829120
+read 4194304/4194304 bytes at offset 130023424
+read 4194304/4194304 bytes at offset 16777216
+read 4194304/4194304 bytes at offset 20971520
+read 4194304/4194304 bytes at offset 25165824
+read 4194304/4194304 bytes at offset 29360128
+read 4194304/4194304 bytes at offset 33554432
+read 4194304/4194304 bytes at offset 37748736
+read 4194304/4194304 bytes at offset 4194304
+read 4194304/4194304 bytes at offset 41943040
+read 4194304/4194304 bytes at offset 46137344
+read 4194304/4194304 bytes at offset 50331648
+read 4194304/4194304 bytes at offset 54525952
+read 4194304/4194304 bytes at offset 58720256
+read 4194304/4194304 bytes at offset 62914560
+read 4194304/4194304 bytes at offset 67108864
+read 4194304/4194304 bytes at offset 71303168
+read 4194304/4194304 bytes at offset 75497472
+read 4194304/4194304 bytes at offset 79691776
+read 4194304/4194304 bytes at offset 8388608
+read 4194304/4194304 bytes at offset 83886080
+read 4194304/4194304 bytes at offset 88080384
+read 4194304/4194304 bytes at offset 92274688
+read 4194304/4194304 bytes at offset 96468992
+965b1c8163a4c846f01a76d0a6b85959 -
+reconnection while qemu-img read
+reconnection while qemu-img write
+965b1c8163a4c846f01a76d0a6b85959 -
diff --git a/tests/functional/072 b/tests/functional/072
new file mode 100755
index 0000000..7cefd46
--- /dev/null
+++ b/tests/functional/072
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+# Test qemu I/O while qemu reconnection is ongoing
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1 # failure is the default!
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+_cleanup
+
+for i in `seq 0 2`; do
+ _start_sheep $i
+done
+
+_wait_for_sheep 3
+
+_cluster_format -c 2
+
+$COLLIE vdi create test 4M
+sleep 1
+
+_qemu_io_cmd()
+{
+ cmd=$1 # read or write
+
+ sleep 1
+
+ _kill_sheep 0
+ _wait_for_sheep_stop 0
+ echo aio_$cmd -P 1 0 1k
+ echo aio_$cmd -P 2 2k 1k
+ echo aio_$cmd -P 3 4k 1k
+ echo aio_$cmd -P 4 8k 1k
+ echo aio_flush
+ echo flush
+ sleep 1
+
+ _start_sheep 0
+ _wait_for_sheep 3
+ echo quit
+}
+
+echo create and write while reconnection
+_qemu_io_cmd "write" | qemu-io sheepdog:test 2> /dev/null | _filter_qemu_io | sort
+$COLLIE vdi read test | md5sum
+
+echo read while reconnection
+_qemu_io_cmd "read" | qemu-io sheepdog:test 2> /dev/null | _filter_qemu_io | sort
+$COLLIE vdi read test | md5sum
+
+echo write while reconnection
+_qemu_io_cmd "write" | qemu-io sheepdog:test 2> /dev/null | _filter_qemu_io | sort
+$COLLIE vdi read test | md5sum
diff --git a/tests/functional/072.out b/tests/functional/072.out
new file mode 100644
index 0000000..b43ffa2
--- /dev/null
+++ b/tests/functional/072.out
@@ -0,0 +1,32 @@
+QA output created by 072
+using backend plain store
+create and write while reconnection
+1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 1024/1024 bytes at offset 0
+wrote 1024/1024 bytes at offset 2048
+wrote 1024/1024 bytes at offset 4096
+wrote 1024/1024 bytes at offset 8192
+4a05c5b1cc8b68058475dc9b07ddb012 -
+read while reconnection
+1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 1024/1024 bytes at offset 0
+read 1024/1024 bytes at offset 2048
+read 1024/1024 bytes at offset 4096
+read 1024/1024 bytes at offset 8192
+4a05c5b1cc8b68058475dc9b07ddb012 -
+write while reconnection
+1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 1024/1024 bytes at offset 0
+wrote 1024/1024 bytes at offset 2048
+wrote 1024/1024 bytes at offset 4096
+wrote 1024/1024 bytes at offset 8192
+4a05c5b1cc8b68058475dc9b07ddb012 -
diff --git a/tests/functional/common.filter b/tests/functional/common.filter
index f1fffc4..ae649ae 100644
--- a/tests/functional/common.filter
+++ b/tests/functional/common.filter
@@ -154,7 +154,8 @@ _filter_cluster_info()
# sanitize qemu-io output
_filter_qemu_io()
{
- sed -e "s/[0-9]* ops\; [0-9/:. sec]* ([0-9/.inf]* [EPTGMKiBbytes]*\/sec and [0-9/.inf]* ops\/sec)/X ops\; XX:XX:XX.X (XXX YYY\/sec and XXX ops\/sec)/"
+ sed -e "s/[0-9]* ops\; [0-9/:. sec]* ([0-9/.inf]* [EPTGMKiBbytes]*\/sec and [0-9/.inf]* ops\/sec)/X ops\; XX:XX:XX.X (XXX YYY\/sec and XXX ops\/sec)/" \
+ | sed 's/qemu-io> //g'
}
# normalize store directory name
diff --git a/tests/functional/common.rc b/tests/functional/common.rc
index a3f574c..d808ad5 100644
--- a/tests/functional/common.rc
+++ b/tests/functional/common.rc
@@ -141,6 +141,7 @@ _die()
_cleanup()
{
local i
+ killall -9 qemu-io qemu-img 2> /dev/null
_kill_all_collies
_kill_all_sheeps
diff --git a/tests/functional/group b/tests/functional/group
index c16acc7..5ba9a33 100644
--- a/tests/functional/group
+++ b/tests/functional/group
@@ -84,3 +84,5 @@
068 auto quick cluster
069 auto quick cluster md
070 auto quick cluster md
+071 auto quick store md
+072 auto quick store md
--
1.8.1.3.566.gaa39828
More information about the sheepdog
mailing list