[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 54/64] iotests: Test that qcow2's data-file is flushed
From: |
Kevin Wolf |
Subject: |
[PULL 54/64] iotests: Test that qcow2's data-file is flushed |
Date: |
Mon, 7 Sep 2020 13:09:26 +0200 |
From: Max Reitz <mreitz@redhat.com>
Flushing a qcow2 node must lead to the data-file node being flushed as
well.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
---
tests/qemu-iotests/244 | 49 ++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/244.out | 7 ++++++
2 files changed, 56 insertions(+)
diff --git a/tests/qemu-iotests/244 b/tests/qemu-iotests/244
index efe3c0428b..f2b2dddf1c 100755
--- a/tests/qemu-iotests/244
+++ b/tests/qemu-iotests/244
@@ -217,6 +217,55 @@ $QEMU_IMG amend -f $IMGFMT -o
"data_file=blkdebug::$TEST_IMG.data" "$TEST_IMG"
$QEMU_IMG convert -f $IMGFMT -O $IMGFMT -n -C "$TEST_IMG.src" "$TEST_IMG"
$QEMU_IMG compare -f $IMGFMT -F $IMGFMT "$TEST_IMG.src" "$TEST_IMG"
+echo
+echo "=== Flushing should flush the data file ==="
+echo
+
+# We are going to flush a qcow2 file with a blkdebug node inserted
+# between the qcow2 node and its data file node. The blkdebug node
+# will return an error for all flushes and so we if the data file is
+# flushed, we will see qemu-io return an error.
+
+# We need to write something or the flush will not do anything; we
+# also need -t writeback so the write is not done as a FUA write
+# (which would then fail thanks to the implicit flush)
+$QEMU_IO -c 'write 0 512' -c flush \
+ -t writeback \
+ "json:{
+ 'driver': 'qcow2',
+ 'file': {
+ 'driver': 'file',
+ 'filename': '$TEST_IMG'
+ },
+ 'data-file': {
+ 'driver': 'blkdebug',
+ 'inject-error': [{
+ 'event': 'none',
+ 'iotype': 'flush'
+ }],
+ 'image': {
+ 'driver': 'file',
+ 'filename': '$TEST_IMG.data'
+ }
+ }
+ }" \
+ | _filter_qemu_io
+
+result=${PIPESTATUS[0]}
+echo
+
+case $result in
+ 0)
+ echo "ERROR: qemu-io succeeded, so the data file was not flushed"
+ ;;
+ 1)
+ echo "Success: qemu-io failed, so the data file was flushed"
+ ;;
+ *)
+ echo "ERROR: qemu-io returned unknown exit code $result"
+ ;;
+esac
+
# success, all done
echo "*** done"
rm -f $seq.full
diff --git a/tests/qemu-iotests/244.out b/tests/qemu-iotests/244.out
index dbab7359a9..7269b4295a 100644
--- a/tests/qemu-iotests/244.out
+++ b/tests/qemu-iotests/244.out
@@ -131,4 +131,11 @@ Offset Length Mapped to File
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
data_file=TEST_DIR/t.IMGFMT.data
Images are identical.
Images are identical.
+
+=== Flushing should flush the data file ===
+
+wrote 512/512 bytes at offset 0
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
+Success: qemu-io failed, so the data file was flushed
*** done
--
2.25.4
- [PULL 33/64] vmdk: Drop vmdk_co_flush(), (continued)
- [PULL 33/64] vmdk: Drop vmdk_co_flush(), Kevin Wolf, 2020/09/07
- [PULL 45/64] mirror: Deal with filters, Kevin Wolf, 2020/09/07
- [PULL 48/64] nbd: Use CAF when looking for dirty bitmap, Kevin Wolf, 2020/09/07
- [PULL 46/64] backup: Deal with filters, Kevin Wolf, 2020/09/07
- [PULL 51/64] blockdev: Fix active commit choice, Kevin Wolf, 2020/09/07
- [PULL 47/64] commit: Deal with filters, Kevin Wolf, 2020/09/07
- [PULL 49/64] qemu-img: Use child access functions, Kevin Wolf, 2020/09/07
- [PULL 50/64] block: Drop backing_bs(), Kevin Wolf, 2020/09/07
- [PULL 42/64] block: Report data child for query-blockstats, Kevin Wolf, 2020/09/07
- [PULL 53/64] block: Leave BDS.backing_{file,format} constant, Kevin Wolf, 2020/09/07
- [PULL 54/64] iotests: Test that qcow2's data-file is flushed,
Kevin Wolf <=
- [PULL 55/64] iotests: Let complete_and_wait() work with commit, Kevin Wolf, 2020/09/07
- [PULL 56/64] iotests: Add filter commit test cases, Kevin Wolf, 2020/09/07
- [PULL 52/64] block: Inline bdrv_co_block_status_from_*(), Kevin Wolf, 2020/09/07
- [PULL 58/64] iotests: Add test for commit in sub directory, Kevin Wolf, 2020/09/07
- [PULL 59/64] iotests: Test committing to overridden backing, Kevin Wolf, 2020/09/07
- [PULL 60/64] iotests: Allow running from different directory, Kevin Wolf, 2020/09/07
- [PULL 61/64] file-win32: Fix "locking" option, Kevin Wolf, 2020/09/07
- [PULL 63/64] block/nvme: Use generic NvmeBar structure, Kevin Wolf, 2020/09/07
- [PULL 57/64] iotests: Add filter mirror test cases, Kevin Wolf, 2020/09/07
- [PULL 62/64] block/nvme: Group controller registers in NVMeRegs structure, Kevin Wolf, 2020/09/07