summaryrefslogtreecommitdiffstats
path: root/tests/qemu-iotests/026
diff options
context:
space:
mode:
authorKevin Wolf2018-06-28 17:18:51 +0200
committerKevin Wolf2018-06-29 14:20:56 +0200
commitae376c6255d0eee4b3c4d60acc4679aa99c0d2c8 (patch)
tree01bcc8e84ff6596f91a864ea1c97dbe9f2b92974 /tests/qemu-iotests/026
parentqcow2: Free allocated clusters on write error (diff)
downloadqemu-ae376c6255d0eee4b3c4d60acc4679aa99c0d2c8.tar.gz
qemu-ae376c6255d0eee4b3c4d60acc4679aa99c0d2c8.tar.xz
qemu-ae376c6255d0eee4b3c4d60acc4679aa99c0d2c8.zip
qemu-iotests: Test qcow2 not leaking clusters on write error
This adds a test for a temporary write failure, which simulates the situation after werror=stop/enospc has stopped the VM. We shouldn't leave leaked clusters behind in such cases. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/026')
-rwxr-xr-xtests/qemu-iotests/02617
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026
index 7fadfbace5..582d254195 100755
--- a/tests/qemu-iotests/026
+++ b/tests/qemu-iotests/026
@@ -200,6 +200,23 @@ done
done
done
+echo
+echo === Avoid cluster leaks after temporary failure ===
+echo
+
+cat > "$TEST_DIR/blkdebug.conf" <<EOF
+[inject-error]
+event = "write_aio"
+errno = "5"
+once = "on"
+EOF
+
+# After the failed first write, do a second write so that the updated refcount
+# block is actually written back
+_make_test_img 64M
+$QEMU_IO -c "write 0 1M" -c "write 0 1M" "$BLKDBG_TEST_IMG" | _filter_qemu_io
+_check_test_img
+
# success, all done
echo "*** done"
rm -f $seq.full