[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 42/47] iotests: Test that qcow2's data-file is flushed
From: |
Max Reitz |
Subject: |
[PATCH v7 42/47] iotests: Test that qcow2's data-file is flushed |
Date: |
Thu, 25 Jun 2020 17:22:10 +0200 |
Flushing a qcow2 node must lead to the data-file node being flushed as
well.
Signed-off-by: Max Reitz <mreitz@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.26.2
- [PATCH v7 31/47] block: Use child access functions for QAPI queries, (continued)
- [PATCH v7 31/47] block: Use child access functions for QAPI queries, Max Reitz, 2020/06/25
- [PATCH v7 33/47] mirror: Deal with filters, Max Reitz, 2020/06/25
- [PATCH v7 36/47] nbd: Use CAF when looking for dirty bitmap, Max Reitz, 2020/06/25
- [PATCH v7 35/47] commit: Deal with filters, Max Reitz, 2020/06/25
- [PATCH v7 34/47] backup: Deal with filters, Max Reitz, 2020/06/25
- [PATCH v7 38/47] block: Drop backing_bs(), Max Reitz, 2020/06/25
- [PATCH v7 37/47] qemu-img: Use child access functions, Max Reitz, 2020/06/25
- [PATCH v7 41/47] block: Leave BDS.backing_file constant, Max Reitz, 2020/06/25
- [PATCH v7 40/47] block: Inline bdrv_co_block_status_from_*(), Max Reitz, 2020/06/25
- [PATCH v7 39/47] blockdev: Fix active commit choice, Max Reitz, 2020/06/25
- [PATCH v7 42/47] iotests: Test that qcow2's data-file is flushed,
Max Reitz <=
- [PATCH v7 43/47] iotests: Let complete_and_wait() work with commit, Max Reitz, 2020/06/25
- [PATCH v7 44/47] iotests: Add filter commit test cases, Max Reitz, 2020/06/25
- [PATCH v7 45/47] iotests: Add filter mirror test cases, Max Reitz, 2020/06/25
- [PATCH v7 46/47] iotests: Add test for commit in sub directory, Max Reitz, 2020/06/25
- [PATCH v7 47/47] iotests: Test committing to overridden backing, Max Reitz, 2020/06/25