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

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