cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From 5f1f1921575005ea286f1eb408f62064728df972 Mon Sep 17 00:00:00 2001
9ae3a8
From: Jeffrey Cody <jcody@redhat.com>
9ae3a8
Date: Wed, 20 Nov 2013 19:44:08 +0100
9ae3a8
Subject: [PATCH 25/25] block: vhdx qemu-iotest - log replay of data sector
9ae3a8
9ae3a8
RH-Author: Jeffrey Cody <jcody@redhat.com>
9ae3a8
Message-id: <1a13302bddec68d7ee3e2f3be3a457c4bc61eea4.1384975172.git.jcody@redhat.com>
9ae3a8
Patchwork-id: 55818
9ae3a8
O-Subject: [RHEL7 qemu-kvm PATCH 25/26] block: vhdx qemu-iotest - log replay of data sector
9ae3a8
Bugzilla: 879234
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
9ae3a8
This tests the replay of a data sector in a VHDX image file.
9ae3a8
9ae3a8
The image file is a 10G dynamic image, with 4MB block size.  The
9ae3a8
image was created with qemu-img, and the log left unplayed by
9ae3a8
modification of the vhdx image format driver.
9ae3a8
9ae3a8
It was verified under both QEMU and Hyper-V that the image file,
9ae3a8
post log replay, matched.
9ae3a8
9ae3a8
Signed-off-by: Jeff Cody <jcody@redhat.com>
9ae3a8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
(cherry picked from commit e78835b722eb26f5a56370166e99b69e9751ea2a)
9ae3a8
9ae3a8
Conflicts:
9ae3a8
	tests/qemu-iotests/group
9ae3a8
9ae3a8
RHEL7 Notes: Conflict due to test number leapfrogging tests that have
9ae3a8
             not yet been backported into RHEL7.
9ae3a8
9ae3a8
Signed-off-by: Jeff Cody <jcody@redhat.com>
9ae3a8
---
9ae3a8
 tests/qemu-iotests/070                             |  67 +++++++++++++++++++++
9ae3a8
 tests/qemu-iotests/070.out                         |   8 +++
9ae3a8
 tests/qemu-iotests/group                           |   1 +
9ae3a8
 4 files changed, 76 insertions(+)
9ae3a8
 create mode 100755 tests/qemu-iotests/070
9ae3a8
 create mode 100644 tests/qemu-iotests/070.out
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 tests/qemu-iotests/070     |   67 ++++++++++++++++++++++++++++++++++++++++++++
9ae3a8
 tests/qemu-iotests/070.out |    8 +++++
9ae3a8
 tests/qemu-iotests/group   |    1 +
9ae3a8
 3 files changed, 76 insertions(+), 0 deletions(-)
9ae3a8
 create mode 100755 tests/qemu-iotests/070
9ae3a8
 create mode 100644 tests/qemu-iotests/070.out
9ae3a8
9ae3a8
diff --git a/tests/qemu-iotests/070 b/tests/qemu-iotests/070
9ae3a8
new file mode 100755
9ae3a8
index 0000000..41bf100
9ae3a8
--- /dev/null
9ae3a8
+++ b/tests/qemu-iotests/070
9ae3a8
@@ -0,0 +1,67 @@
9ae3a8
+#!/bin/bash
9ae3a8
+#
9ae3a8
+# Test VHDX log replay from an image with a journal that needs to be
9ae3a8
+# replayed
9ae3a8
+#
9ae3a8
+# Copyright (C) 2013 Red Hat, Inc.
9ae3a8
+#
9ae3a8
+# This program is free software; you can redistribute it and/or modify
9ae3a8
+# it under the terms of the GNU General Public License as published by
9ae3a8
+# the Free Software Foundation; either version 2 of the License, or
9ae3a8
+# (at your option) any later version.
9ae3a8
+#
9ae3a8
+# This program is distributed in the hope that it will be useful,
9ae3a8
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
9ae3a8
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9ae3a8
+# GNU General Public License for more details.
9ae3a8
+#
9ae3a8
+# You should have received a copy of the GNU General Public License
9ae3a8
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
9ae3a8
+#
9ae3a8
+
9ae3a8
+# creator
9ae3a8
+owner=jcody@redhat.com
9ae3a8
+
9ae3a8
+seq=`basename $0`
9ae3a8
+echo "QA output created by $seq"
9ae3a8
+
9ae3a8
+here=`pwd`
9ae3a8
+tmp=/tmp/$$
9ae3a8
+status=1	# failure is the default!
9ae3a8
+
9ae3a8
+_cleanup()
9ae3a8
+{
9ae3a8
+    _cleanup_test_img
9ae3a8
+}
9ae3a8
+trap "_cleanup; exit \$status" 0 1 2 3 15
9ae3a8
+
9ae3a8
+# get standard environment, filters and checks
9ae3a8
+. ./common.rc
9ae3a8
+. ./common.filter
9ae3a8
+
9ae3a8
+_supported_fmt vhdx
9ae3a8
+_supported_proto generic
9ae3a8
+_supported_os Linux
9ae3a8
+
9ae3a8
+# With the log replayed, the pattern 0xa5 extends to 0xc025000
9ae3a8
+# If the log was not replayed, it would only extend to 0xc000000
9ae3a8
+#
9ae3a8
+# This image is a 10G dynamic image, with 4M block size, and 1 unplayed
9ae3a8
+# data sector in the log
9ae3a8
+#
9ae3a8
+# This image was created with qemu-img, however it was verified using
9ae3a8
+# Hyper-V to properly replay the logs and give the same post-replay
9ae3a8
+# image as qemu.
9ae3a8
+_use_sample_img iotest-dirtylog-10G-4M.vhdx.bz2
9ae3a8
+
9ae3a8
+echo
9ae3a8
+echo "=== Verify open image read-only fails, due to dirty log ==="
9ae3a8
+$QEMU_IO -r -c "read -pP 0xa5 0 18M" "$TEST_IMG" 2>&1 | grep -o "Permission denied"
9ae3a8
+
9ae3a8
+echo "=== Verify open image replays log  ==="
9ae3a8
+$QEMU_IO  -c "read -pP 0xa5 0 18M" "$TEST_IMG" | _filter_qemu_io
9ae3a8
+
9ae3a8
+# success, all done
9ae3a8
+echo "*** done"
9ae3a8
+rm -f $seq.full
9ae3a8
+status=0
9ae3a8
diff --git a/tests/qemu-iotests/070.out b/tests/qemu-iotests/070.out
9ae3a8
new file mode 100644
9ae3a8
index 0000000..9db8ff2
9ae3a8
--- /dev/null
9ae3a8
+++ b/tests/qemu-iotests/070.out
9ae3a8
@@ -0,0 +1,8 @@
9ae3a8
+QA output created by 070
9ae3a8
+
9ae3a8
+=== Verify open image read-only fails, due to dirty log ===
9ae3a8
+Permission denied
9ae3a8
+=== Verify open image replays log  ===
9ae3a8
+read 18874368/18874368 bytes at offset 0
9ae3a8
+18 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
9ae3a8
+*** done
9ae3a8
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
9ae3a8
index 1a182ed..0867b0f 100644
9ae3a8
--- a/tests/qemu-iotests/group
9ae3a8
+++ b/tests/qemu-iotests/group
9ae3a8
@@ -68,3 +68,4 @@
9ae3a8
 065 rw auto
9ae3a8
 067 rw auto
9ae3a8
 068 rw auto
9ae3a8
+070 rw auto
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8