qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

iotests/229: Use blkdebug to inject an error

229 relies on the mirror running into an I/O error when the target is
smaller than the source. After changing mirror to catch this condition
while starting the job, this test case won't get a job that is paused
for an I/O error any more. Use blkdebug instead to inject an error.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200511135825.219437-3-kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>

+16 -8
+13 -5
tests/qemu-iotests/229
··· 33 33 _cleanup_test_img 34 34 _rm_test_img "$TEST_IMG" 35 35 _rm_test_img "$DEST_IMG" 36 + rm -f "$TEST_DIR/blkdebug.conf" 36 37 } 37 38 trap "_cleanup; exit \$status" 0 1 2 3 15 38 39 ··· 49 50 50 51 DEST_IMG="$TEST_DIR/d.$IMGFMT" 51 52 TEST_IMG="$TEST_DIR/b.$IMGFMT" 53 + BLKDEBUG_CONF="$TEST_DIR/blkdebug.conf" 52 54 53 55 _make_test_img 2M 54 - 55 - # destination for mirror will be too small, causing error 56 - TEST_IMG=$DEST_IMG _make_test_img 1M 56 + TEST_IMG=$DEST_IMG _make_test_img 2M 57 57 58 58 $QEMU_IO -c 'write 0 2M' "$TEST_IMG" | _filter_qemu_io 59 59 ··· 67 67 echo '=== Starting drive-mirror, causing error & stop ===' 68 68 echo 69 69 70 + cat > "$BLKDEBUG_CONF" <<EOF 71 + [inject-error] 72 + event = "write_aio" 73 + errno = "5" 74 + once = "on" 75 + EOF 76 + 70 77 _send_qemu_cmd $QEMU_HANDLE \ 71 78 "{'execute': 'drive-mirror', 72 79 'arguments': {'device': 'testdisk', 73 80 'format': '$IMGFMT', 74 - 'target': '$DEST_IMG', 81 + 'target': 'blkdebug:$BLKDEBUG_CONF:$DEST_IMG', 75 82 'sync': 'full', 76 83 'mode': 'existing', 77 84 'on-source-error': 'stop', ··· 90 97 'arguments': { 'device': 'testdisk', 91 98 'force': true}}" \ 92 99 "BLOCK_JOB_CANCELLED" "Assertion" \ 93 - | grep -v '"BLOCK_JOB_ERROR"' 100 + | grep -v '"BLOCK_JOB_ERROR"' \ 101 + | _filter_block_job_offset 94 102 95 103 # success, all done 96 104 echo "*** done"
+3 -3
tests/qemu-iotests/229.out
··· 1 1 QA output created by 229 2 2 Formatting 'TEST_DIR/b.IMGFMT', fmt=IMGFMT size=2097152 3 - Formatting 'TEST_DIR/d.IMGFMT', fmt=IMGFMT size=1048576 3 + Formatting 'TEST_DIR/d.IMGFMT', fmt=IMGFMT size=2097152 4 4 wrote 2097152/2097152 bytes at offset 0 5 5 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 6 6 {'execute': 'qmp_capabilities'} ··· 8 8 9 9 === Starting drive-mirror, causing error & stop === 10 10 11 - {'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' }} 11 + {'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' }} 12 12 {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "testdisk"}} 13 13 {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "testdisk"}} 14 14 {"return": {}} ··· 21 21 {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "testdisk"}} 22 22 {"return": {}} 23 23 {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "aborting", "id": "testdisk"}} 24 - {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "testdisk", "len": 2097152, "offset": 1048576, "speed": 0, "type": "mirror"}} 24 + {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "testdisk", "len": 2097152, "offset": OFFSET, "speed": 0, "type": "mirror"}} 25 25 *** done