|
|
ae23c9 |
From 589a3182bf175c8e83e7910d11810610fb3134a2 Mon Sep 17 00:00:00 2001
|
|
|
ae23c9 |
From: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
Date: Mon, 18 Jun 2018 18:00:55 +0200
|
|
|
ae23c9 |
Subject: [PATCH 058/268] iotests: Add case for a corrupted inactive image
|
|
|
ae23c9 |
|
|
|
ae23c9 |
RH-Author: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
Message-id: <20180618180055.22739-4-mreitz@redhat.com>
|
|
|
ae23c9 |
Patchwork-id: 80794
|
|
|
ae23c9 |
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 3/3] iotests: Add case for a corrupted inactive image
|
|
|
ae23c9 |
Bugzilla: 1588039
|
|
|
ae23c9 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Reviewed-by: John Snow <jsnow@redhat.com>
|
|
|
ae23c9 |
Tested-by: Jeff Cody <jcody@redhat.com>
|
|
|
ae23c9 |
Reviewed-by: Jeff Cody <jcody@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
Message-id: 20180606193702.7113-4-mreitz@redhat.com
|
|
|
ae23c9 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
(cherry picked from commit c50abd175a88cd41c2c08339de91f6f6e4a7b162)
|
|
|
ae23c9 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
ae23c9 |
---
|
|
|
ae23c9 |
tests/qemu-iotests/060 | 30 ++++++++++++++++++++++++++++++
|
|
|
ae23c9 |
tests/qemu-iotests/060.out | 14 ++++++++++++++
|
|
|
ae23c9 |
2 files changed, 44 insertions(+)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
|
|
|
ae23c9 |
index 6c7407f..7bdf609 100755
|
|
|
ae23c9 |
--- a/tests/qemu-iotests/060
|
|
|
ae23c9 |
+++ b/tests/qemu-iotests/060
|
|
|
ae23c9 |
@@ -440,6 +440,36 @@ echo "{'execute': 'qmp_capabilities'}
|
|
|
ae23c9 |
-drive if=none,node-name=drive,file="$TEST_IMG",driver=qcow2 \
|
|
|
ae23c9 |
| _filter_qmp | _filter_qemu_io
|
|
|
ae23c9 |
|
|
|
ae23c9 |
+echo
|
|
|
ae23c9 |
+echo "=== Testing incoming inactive corrupted image ==="
|
|
|
ae23c9 |
+echo
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+_make_test_img 64M
|
|
|
ae23c9 |
+# Create an unaligned L1 entry, so qemu will signal a corruption when
|
|
|
ae23c9 |
+# reading from the covered area
|
|
|
ae23c9 |
+poke_file "$TEST_IMG" "$l1_offset" "\x00\x00\x00\x00\x2a\x2a\x2a\x2a"
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+# Inactive images are effectively read-only images, so this should be a
|
|
|
ae23c9 |
+# non-fatal corruption (which does not modify the image)
|
|
|
ae23c9 |
+echo "{'execute': 'qmp_capabilities'}
|
|
|
ae23c9 |
+ {'execute': 'human-monitor-command',
|
|
|
ae23c9 |
+ 'arguments': {'command-line': 'qemu-io drive \"read 0 512\"'}}
|
|
|
ae23c9 |
+ {'execute': 'quit'}" \
|
|
|
ae23c9 |
+ | $QEMU -qmp stdio -nographic -nodefaults \
|
|
|
ae23c9 |
+ -blockdev "{'node-name': 'drive',
|
|
|
ae23c9 |
+ 'driver': 'qcow2',
|
|
|
ae23c9 |
+ 'file': {
|
|
|
ae23c9 |
+ 'driver': 'file',
|
|
|
ae23c9 |
+ 'filename': '$TEST_IMG'
|
|
|
ae23c9 |
+ }}" \
|
|
|
ae23c9 |
+ -incoming exec:'cat /dev/null' \
|
|
|
ae23c9 |
+ 2>&1 \
|
|
|
ae23c9 |
+ | _filter_qmp | _filter_qemu_io
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+echo
|
|
|
ae23c9 |
+# Image should not have been marked corrupt
|
|
|
ae23c9 |
+_img_info --format-specific | grep 'corrupt:'
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
# success, all done
|
|
|
ae23c9 |
echo "*** done"
|
|
|
ae23c9 |
rm -f $seq.full
|
|
|
ae23c9 |
diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out
|
|
|
ae23c9 |
index 25d5c39..99234fb 100644
|
|
|
ae23c9 |
--- a/tests/qemu-iotests/060.out
|
|
|
ae23c9 |
+++ b/tests/qemu-iotests/060.out
|
|
|
ae23c9 |
@@ -420,4 +420,18 @@ write failed: Input/output error
|
|
|
ae23c9 |
{"return": ""}
|
|
|
ae23c9 |
{"return": {}}
|
|
|
ae23c9 |
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+=== Testing incoming inactive corrupted image ===
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
|
ae23c9 |
+QMP_VERSION
|
|
|
ae23c9 |
+{"return": {}}
|
|
|
ae23c9 |
+qcow2: Image is corrupt: L2 table offset 0x2a2a2a00 unaligned (L1 index: 0); further non-fatal corruption events will be suppressed
|
|
|
ae23c9 |
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_IMAGE_CORRUPTED", "data": {"device": "", "msg": "L2 table offset 0x2a2a2a00 unaligned (L1 index: 0)", "node-name": "drive", "fatal": false}}
|
|
|
ae23c9 |
+read failed: Input/output error
|
|
|
ae23c9 |
+{"return": ""}
|
|
|
ae23c9 |
+{"return": {}}
|
|
|
ae23c9 |
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+ corrupt: false
|
|
|
ae23c9 |
*** done
|
|
|
ae23c9 |
--
|
|
|
ae23c9 |
1.8.3.1
|
|
|
ae23c9 |
|