yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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