Patchwork [PULL,36/36] block: vhdx qemu-iotest - log replay of data sector

login
register
mail settings
Submitter Stefan Hajnoczi
Date Nov. 7, 2013, 1:12 p.m.
Message ID <1383829964-32364-37-git-send-email-stefanha@redhat.com>
Download mbox | patch
Permalink /patch/289347/
State New
Headers show

Comments

Stefan Hajnoczi - Nov. 7, 2013, 1:12 p.m.
From: Jeff Cody <jcody@redhat.com>

This tests the replay of a data sector in a VHDX image file.

The image file is a 10G dynamic image, with 4MB block size.  The
image was created with qemu-img, and the log left unplayed by
modification of the vhdx image format driver.

It was verified under both QEMU and Hyper-V that the image file,
post log replay, matched.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 tests/qemu-iotests/070                             |  67 +++++++++++++++++++++
 tests/qemu-iotests/070.out                         |   8 +++
 tests/qemu-iotests/group                           |   1 +
 .../sample_images/iotest-dirtylog-10G-4M.vhdx.bz2  | Bin 0 -> 4490 bytes
 4 files changed, 76 insertions(+)
 create mode 100755 tests/qemu-iotests/070
 create mode 100644 tests/qemu-iotests/070.out
 create mode 100644 tests/qemu-iotests/sample_images/iotest-dirtylog-10G-4M.vhdx.bz2

diff --git a/tests/qemu-iotests/sample_images/iotest-dirtylog-10G-4M.vhdx.bz2 b/tests/qemu-iotests/sample_images/iotest-dirtylog-10G-4M.vhdx.bz2
new file mode 100644
index 0000000000000000000000000000000000000000..4b91cfc654b9b8b46ff45918b6f9a2f88d47ecf0
GIT binary patch
literal 4490
zcmV;55q0iDT4*^jL0KkKS$k&2jsZ0{fB*mg|NsC0|NsC0|NsC0|NsC0|NsC0|NsC0
z|NsC0|Nr0&KYaiIlYO_ZcRTI9zV`F0x$m=gzWd(y-zN9hz4y-D_uhSdA3nFvh^Y#D
z3N-W+)gBsC)bz}ZrZlILew2Gu*e9xbn-M=#1j3#IpQ)+hVw(d~8mH(cr=uY@Nt$S7
zGgH${gz#w-)Y_X->Uoh(srnT2MvW5!o=m5hQ`E_($r-8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I$!`9*oojiwhWnv6GLStINPYpy`fwfN;O1!6Bvi1
zBW0dnY9fguH_^_@d(R`x%qr)X6t<B?O}RkDjD#a4ld#@7o_k?0vzg7eHU@hcmaC1y
z0JEj-eup=j+jJNlse7-fDb}q(i(+E^kt7!pU`j>~fvh?(&4GKKym~<mh5!LA3O@Bx
z-o*VC%qLZ8xkSND_J)eX6GD2uU9bQN30GGR&}DUc7~A{t%wsSGY0PB(Y8OP7e_Jj-
z*Dqc{l25fuaM<m&n8;hzb3MrB>EH)G=|rvUJwCxb5ds7NA_N3OOmymrw&d^*<N*;7
zA_M^rO||=VDGv^ZzEvk)YQ(ZUKq0x-kNebWpv}22AM;b#={mdrqAGwm*s3hoAEV5<
cz~{b~DWmIpofZ)k0WbKwk}1N3gWEPVaE0D!L;wH)

literal 0
HcmV?d00001

Patch

diff --git a/tests/qemu-iotests/070 b/tests/qemu-iotests/070
new file mode 100755
index 0000000..41bf100
--- /dev/null
+++ b/tests/qemu-iotests/070
@@ -0,0 +1,67 @@ 
+#!/bin/bash
+#
+# Test VHDX log replay from an image with a journal that needs to be
+# replayed
+#
+# Copyright (C) 2013 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+# creator
+owner=jcody@redhat.com
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+
+_cleanup()
+{
+    _cleanup_test_img
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+_supported_fmt vhdx
+_supported_proto generic
+_supported_os Linux
+
+# With the log replayed, the pattern 0xa5 extends to 0xc025000
+# If the log was not replayed, it would only extend to 0xc000000
+#
+# This image is a 10G dynamic image, with 4M block size, and 1 unplayed
+# data sector in the log
+#
+# This image was created with qemu-img, however it was verified using
+# Hyper-V to properly replay the logs and give the same post-replay
+# image as qemu.
+_use_sample_img iotest-dirtylog-10G-4M.vhdx.bz2
+
+echo
+echo "=== Verify open image read-only fails, due to dirty log ==="
+$QEMU_IO -r -c "read -pP 0xa5 0 18M" "$TEST_IMG" 2>&1 | grep -o "Permission denied"
+
+echo "=== Verify open image replays log  ==="
+$QEMU_IO  -c "read -pP 0xa5 0 18M" "$TEST_IMG" | _filter_qemu_io
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
diff --git a/tests/qemu-iotests/070.out b/tests/qemu-iotests/070.out
new file mode 100644
index 0000000..9db8ff2
--- /dev/null
+++ b/tests/qemu-iotests/070.out
@@ -0,0 +1,8 @@ 
+QA output created by 070
+
+=== Verify open image read-only fails, due to dirty log ===
+Permission denied
+=== Verify open image replays log  ===
+read 18874368/18874368 bytes at offset 0
+18 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+*** done
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index c57ff35..b18b241 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -75,3 +75,4 @@ 
 067 rw auto
 068 rw auto
 069 rw auto
+070 rw auto