Blame SOURCES/kvm-qemu-iotests-Test-qcow2-not-leaking-clusters-on-writ.patch

1bdc94
From 52970228a0ba4956ed98cb1ae370b16dd740c9e4 Mon Sep 17 00:00:00 2001
1bdc94
From: Kevin Wolf <kwolf@redhat.com>
1bdc94
Date: Mon, 2 Jul 2018 15:40:08 +0200
1bdc94
Subject: [PATCH 55/57] qemu-iotests: Test qcow2 not leaking clusters on write
1bdc94
 error
1bdc94
1bdc94
RH-Author: Kevin Wolf <kwolf@redhat.com>
1bdc94
Message-id: <20180702154008.15533-4-kwolf@redhat.com>
1bdc94
Patchwork-id: 81187
1bdc94
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 3/3] qemu-iotests: Test qcow2 not leaking clusters on write error
1bdc94
Bugzilla: 1528541
1bdc94
RH-Acked-by: Max Reitz <mreitz@redhat.com>
1bdc94
RH-Acked-by: Fam Zheng <famz@redhat.com>
1bdc94
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
1bdc94
1bdc94
This adds a test for a temporary write failure, which simulates the
1bdc94
situation after werror=stop/enospc has stopped the VM. We shouldn't
1bdc94
leave leaked clusters behind in such cases.
1bdc94
1bdc94
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1bdc94
Reviewed-by: Max Reitz <mreitz@redhat.com>
1bdc94
(cherry picked from commit ae376c6255d0eee4b3c4d60acc4679aa99c0d2c8)
1bdc94
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1bdc94
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
1bdc94
---
1bdc94
 tests/qemu-iotests/026             | 17 +++++++++++++++++
1bdc94
 tests/qemu-iotests/026.out         |  8 ++++++++
1bdc94
 tests/qemu-iotests/026.out.nocache |  8 ++++++++
1bdc94
 3 files changed, 33 insertions(+)
1bdc94
1bdc94
diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026
1bdc94
index 7fadfba..582d254 100755
1bdc94
--- a/tests/qemu-iotests/026
1bdc94
+++ b/tests/qemu-iotests/026
1bdc94
@@ -200,6 +200,23 @@ done
1bdc94
 done
1bdc94
 done
1bdc94
 
1bdc94
+echo
1bdc94
+echo === Avoid cluster leaks after temporary failure ===
1bdc94
+echo
1bdc94
+
1bdc94
+cat > "$TEST_DIR/blkdebug.conf" <
1bdc94
+[inject-error]
1bdc94
+event = "write_aio"
1bdc94
+errno = "5"
1bdc94
+once = "on"
1bdc94
+EOF
1bdc94
+
1bdc94
+# After the failed first write, do a second write so that the updated refcount
1bdc94
+# block is actually written back
1bdc94
+_make_test_img 64M
1bdc94
+$QEMU_IO -c "write 0 1M" -c "write 0 1M" "$BLKDBG_TEST_IMG" | _filter_qemu_io
1bdc94
+_check_test_img
1bdc94
+
1bdc94
 # success, all done
1bdc94
 echo "*** done"
1bdc94
 rm -f $seq.full
1bdc94
diff --git a/tests/qemu-iotests/026.out b/tests/qemu-iotests/026.out
1bdc94
index 8e89416..dd10a82 100644
1bdc94
--- a/tests/qemu-iotests/026.out
1bdc94
+++ b/tests/qemu-iotests/026.out
1bdc94
@@ -675,4 +675,12 @@ write failed: No space left on device
1bdc94
 
1bdc94
 96 leaked clusters were found on the image.
1bdc94
 This means waste of disk space, but no harm to data.
1bdc94
+
1bdc94
+=== Avoid cluster leaks after temporary failure ===
1bdc94
+
1bdc94
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
1bdc94
+write failed: Input/output error
1bdc94
+wrote 1048576/1048576 bytes at offset 0
1bdc94
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
1bdc94
+No errors were found on the image.
1bdc94
 *** done
1bdc94
diff --git a/tests/qemu-iotests/026.out.nocache b/tests/qemu-iotests/026.out.nocache
1bdc94
index 650ccd8..1ca6cda 100644
1bdc94
--- a/tests/qemu-iotests/026.out.nocache
1bdc94
+++ b/tests/qemu-iotests/026.out.nocache
1bdc94
@@ -683,4 +683,12 @@ write failed: No space left on device
1bdc94
 
1bdc94
 96 leaked clusters were found on the image.
1bdc94
 This means waste of disk space, but no harm to data.
1bdc94
+
1bdc94
+=== Avoid cluster leaks after temporary failure ===
1bdc94
+
1bdc94
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
1bdc94
+write failed: Input/output error
1bdc94
+wrote 1048576/1048576 bytes at offset 0
1bdc94
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
1bdc94
+No errors were found on the image.
1bdc94
 *** done
1bdc94
-- 
1bdc94
1.8.3.1
1bdc94