|
|
77c23f |
From 104c8f6210bf573cf39c2a14cdb0b081baaaa3f0 Mon Sep 17 00:00:00 2001
|
|
|
77c23f |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
77c23f |
Date: Wed, 3 Jun 2020 16:03:23 +0100
|
|
|
77c23f |
Subject: [PATCH 24/26] iotests/229: Use blkdebug to inject an error
|
|
|
77c23f |
|
|
|
77c23f |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
77c23f |
Message-id: <20200603160325.67506-10-kwolf@redhat.com>
|
|
|
77c23f |
Patchwork-id: 97108
|
|
|
77c23f |
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH v2 09/11] iotests/229: Use blkdebug to inject an error
|
|
|
77c23f |
Bugzilla: 1778593
|
|
|
77c23f |
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
|
|
77c23f |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
77c23f |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
77c23f |
|
|
|
77c23f |
229 relies on the mirror running into an I/O error when the target is
|
|
|
77c23f |
smaller than the source. After changing mirror to catch this condition
|
|
|
77c23f |
while starting the job, this test case won't get a job that is paused
|
|
|
77c23f |
for an I/O error any more. Use blkdebug instead to inject an error.
|
|
|
77c23f |
|
|
|
77c23f |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
77c23f |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
77c23f |
Message-Id: <20200511135825.219437-3-kwolf@redhat.com>
|
|
|
77c23f |
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
|
|
77c23f |
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
77c23f |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
77c23f |
(cherry picked from commit d89ac3cf305b28c024a76805a84d75c0ee1e786f)
|
|
|
77c23f |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
77c23f |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
77c23f |
---
|
|
|
77c23f |
tests/qemu-iotests/229 | 18 +++++++++++++-----
|
|
|
77c23f |
tests/qemu-iotests/229.out | 6 +++---
|
|
|
77c23f |
2 files changed, 16 insertions(+), 8 deletions(-)
|
|
|
77c23f |
|
|
|
77c23f |
diff --git a/tests/qemu-iotests/229 b/tests/qemu-iotests/229
|
|
|
77c23f |
index e18a464..511fbc0 100755
|
|
|
77c23f |
--- a/tests/qemu-iotests/229
|
|
|
77c23f |
+++ b/tests/qemu-iotests/229
|
|
|
77c23f |
@@ -32,6 +32,7 @@ _cleanup()
|
|
|
77c23f |
_cleanup_qemu
|
|
|
77c23f |
_cleanup_test_img
|
|
|
77c23f |
rm -f "$TEST_IMG" "$DEST_IMG"
|
|
|
77c23f |
+ rm -f "$TEST_DIR/blkdebug.conf"
|
|
|
77c23f |
}
|
|
|
77c23f |
trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
77c23f |
|
|
|
77c23f |
@@ -48,11 +49,10 @@ _supported_os Linux
|
|
|
77c23f |
|
|
|
77c23f |
DEST_IMG="$TEST_DIR/d.$IMGFMT"
|
|
|
77c23f |
TEST_IMG="$TEST_DIR/b.$IMGFMT"
|
|
|
77c23f |
+BLKDEBUG_CONF="$TEST_DIR/blkdebug.conf"
|
|
|
77c23f |
|
|
|
77c23f |
_make_test_img 2M
|
|
|
77c23f |
-
|
|
|
77c23f |
-# destination for mirror will be too small, causing error
|
|
|
77c23f |
-TEST_IMG=$DEST_IMG _make_test_img 1M
|
|
|
77c23f |
+TEST_IMG=$DEST_IMG _make_test_img 2M
|
|
|
77c23f |
|
|
|
77c23f |
$QEMU_IO -c 'write 0 2M' "$TEST_IMG" | _filter_qemu_io
|
|
|
77c23f |
|
|
|
77c23f |
@@ -66,11 +66,18 @@ echo
|
|
|
77c23f |
echo '=== Starting drive-mirror, causing error & stop ==='
|
|
|
77c23f |
echo
|
|
|
77c23f |
|
|
|
77c23f |
+cat > "$BLKDEBUG_CONF" <
|
|
|
77c23f |
+[inject-error]
|
|
|
77c23f |
+event = "write_aio"
|
|
|
77c23f |
+errno = "5"
|
|
|
77c23f |
+once = "on"
|
|
|
77c23f |
+EOF
|
|
|
77c23f |
+
|
|
|
77c23f |
_send_qemu_cmd $QEMU_HANDLE \
|
|
|
77c23f |
"{'execute': 'drive-mirror',
|
|
|
77c23f |
'arguments': {'device': 'testdisk',
|
|
|
77c23f |
'format': '$IMGFMT',
|
|
|
77c23f |
- 'target': '$DEST_IMG',
|
|
|
77c23f |
+ 'target': 'blkdebug:$BLKDEBUG_CONF:$DEST_IMG',
|
|
|
77c23f |
'sync': 'full',
|
|
|
77c23f |
'mode': 'existing',
|
|
|
77c23f |
'on-source-error': 'stop',
|
|
|
77c23f |
@@ -89,7 +96,8 @@ success_or_failure="y" _send_qemu_cmd $QEMU_HANDLE \
|
|
|
77c23f |
'arguments': { 'device': 'testdisk',
|
|
|
77c23f |
'force': true}}" \
|
|
|
77c23f |
"BLOCK_JOB_CANCELLED" "Assertion" \
|
|
|
77c23f |
- | grep -v '"BLOCK_JOB_ERROR"'
|
|
|
77c23f |
+ | grep -v '"BLOCK_JOB_ERROR"' \
|
|
|
77c23f |
+ | _filter_block_job_offset
|
|
|
77c23f |
|
|
|
77c23f |
# success, all done
|
|
|
77c23f |
echo "*** done"
|
|
|
77c23f |
diff --git a/tests/qemu-iotests/229.out b/tests/qemu-iotests/229.out
|
|
|
77c23f |
index 22350d7..4de6dfa 100644
|
|
|
77c23f |
--- a/tests/qemu-iotests/229.out
|
|
|
77c23f |
+++ b/tests/qemu-iotests/229.out
|
|
|
77c23f |
@@ -1,6 +1,6 @@
|
|
|
77c23f |
QA output created by 229
|
|
|
77c23f |
Formatting 'TEST_DIR/b.IMGFMT', fmt=IMGFMT size=2097152
|
|
|
77c23f |
-Formatting 'TEST_DIR/d.IMGFMT', fmt=IMGFMT size=1048576
|
|
|
77c23f |
+Formatting 'TEST_DIR/d.IMGFMT', fmt=IMGFMT size=2097152
|
|
|
77c23f |
wrote 2097152/2097152 bytes at offset 0
|
|
|
77c23f |
2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
77c23f |
{'execute': 'qmp_capabilities'}
|
|
|
77c23f |
@@ -8,7 +8,7 @@ wrote 2097152/2097152 bytes at offset 0
|
|
|
77c23f |
|
|
|
77c23f |
=== Starting drive-mirror, causing error & stop ===
|
|
|
77c23f |
|
|
|
77c23f |
-{'execute': 'drive-mirror', 'arguments': {'device': 'testdisk', 'format': 'IMGFMT', 'target': 'TEST_DIR/d.IMGFMT', 'sync': 'full', 'mode': 'existing', 'on-source-error': 'stop', 'on-target-error': 'stop' }}
|
|
|
77c23f |
+{'execute': 'drive-mirror', 'arguments': {'device': 'testdisk', 'format': 'IMGFMT', 'target': 'blkdebug:TEST_DIR/blkdebug.conf:TEST_DIR/d.IMGFMT', 'sync': 'full', 'mode': 'existing', 'on-source-error': 'stop', 'on-target-error': 'stop' }}
|
|
|
77c23f |
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "testdisk"}}
|
|
|
77c23f |
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "testdisk"}}
|
|
|
77c23f |
{"return": {}}
|
|
|
77c23f |
@@ -21,5 +21,5 @@ wrote 2097152/2097152 bytes at offset 0
|
|
|
77c23f |
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "testdisk"}}
|
|
|
77c23f |
{"return": {}}
|
|
|
77c23f |
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "aborting", "id": "testdisk"}}
|
|
|
77c23f |
-{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "testdisk", "len": 2097152, "offset": 1048576, "speed": 0, "type": "mirror"}}
|
|
|
77c23f |
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "testdisk", "len": 2097152, "offset": OFFSET, "speed": 0, "type": "mirror"}}
|
|
|
77c23f |
*** done
|
|
|
77c23f |
--
|
|
|
77c23f |
1.8.3.1
|
|
|
77c23f |
|