Skip to content

Commit

Permalink
qemu-iotests: Test qcow2 not leaking clusters on write error
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kevmw committed Jun 29, 2018
1 parent 8b24cd1 commit ae376c6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/qemu-iotests/026
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions tests/qemu-iotests/026.out
Expand Up @@ -675,4 +675,12 @@ write failed: No space left on device

96 leaked clusters were found on the image.
This means waste of disk space, but no harm to data.

=== Avoid cluster leaks after temporary failure ===

Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
write failed: Input/output error
wrote 1048576/1048576 bytes at offset 0
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
No errors were found on the image.
*** done
8 changes: 8 additions & 0 deletions tests/qemu-iotests/026.out.nocache
Expand Up @@ -683,4 +683,12 @@ write failed: No space left on device

96 leaked clusters were found on the image.
This means waste of disk space, but no harm to data.

=== Avoid cluster leaks after temporary failure ===

Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
write failed: Input/output error
wrote 1048576/1048576 bytes at offset 0
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
No errors were found on the image.
*** done

0 comments on commit ae376c6

Please sign in to comment.