In preparation to add more checks in the following commits and show how the behavior changes.
Signed-off-by: Fiona Ebner <[email protected]> --- tests/qemu-iotests/122 | 33 +++++++++++++++++++++++++++++++++ tests/qemu-iotests/122.out | 14 ++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/tests/qemu-iotests/122 b/tests/qemu-iotests/122 index be0f6b79e5..488649f1bd 100755 --- a/tests/qemu-iotests/122 +++ b/tests/qemu-iotests/122 @@ -334,6 +334,39 @@ echo $QEMU_IMG convert -O $IMGFMT -o preallocation=metadata -n \ "$TEST_IMG" "$TEST_IMG".orig && echo "unexpected success" +echo +echo "=== failing flush after convert with default ('unsafe') cache mode ===" +echo + +TEST_IMG="$TEST_IMG".orig _make_test_img 1M +TEST_IMG="$TEST_IMG" _make_test_img 1M + +$QEMU_IO -c "write -P 42 0 1M" "$TEST_IMG".orig | _filter_qemu_io + +target_fails_flush="json:{ + 'driver': '$IMGFMT', + 'file': { + 'driver': 'blkdebug', + 'inject-error': [{ + 'event': 'flush_to_disk' + }], + 'image': { + 'driver': 'file', + 'filename': '$TEST_IMG' + } + } +}" + +$QEMU_IMG convert -f $IMGFMT -O $IMGFMT -n "$TEST_IMG".orig "$target_fails_flush" +echo "qemu-img convert exited with status $?" + +echo +echo "=== failing flush after convert with 'writeback' cache mode ===" +echo + +$QEMU_IMG convert -t writeback -f $IMGFMT -O $IMGFMT -n "$TEST_IMG".orig "$target_fails_flush" +echo "qemu-img convert exited with status $?" + # success, all done echo '*** done' rm -f $seq.full diff --git a/tests/qemu-iotests/122.out b/tests/qemu-iotests/122.out index 6a1aa3fe2b..f3e28f33bc 100644 --- a/tests/qemu-iotests/122.out +++ b/tests/qemu-iotests/122.out @@ -256,4 +256,18 @@ Formatting 'TEST_DIR/t.IMGFMT.orig', fmt=IMGFMT size=67108864 === -n incompatible with -o === qemu-img: -o has no effect when skipping image creation + +=== failing flush after convert with default ('unsafe') cache mode === + +Formatting 'TEST_DIR/t.IMGFMT.orig', fmt=IMGFMT size=1048576 +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 +wrote 1048576/1048576 bytes at offset 0 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-img convert exited with status 0 + +=== failing flush after convert with 'writeback' cache mode === + +qemu-img: Failed to flush the L2 table cache: Input/output error +qemu-img: Failed to flush the refcount block cache: Input/output error +qemu-img convert exited with status 0 *** done -- 2.47.3
