qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

qemu-iotests: allow qcow2 external discarded clusters to contain stale data

Test 244 checks the expected behavior of qcow2 external data files
with respect to zero and discarded clusters. Filesystems however
are free to ignore discard requests, and this seems to be the
case for overlayfs. Relax the tests to skip checks on the
external data file for discarded areas, which implies not using
qemu-img compare in the data_file_raw=on case.

This fixes docker tests on RHEL8.

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200409191006.24429-1-pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>

authored by

Paolo Bonzini and committed by
Kevin Wolf
3fb61087 a50c1f57

+14 -5
+8 -2
tests/qemu-iotests/244
··· 143 143 echo 144 144 $QEMU_IO -c 'read -P 0 0 1M' \ 145 145 -c 'read -P 0x11 1M 1M' \ 146 - -c 'read -P 0 2M 2M' \ 147 146 -c 'read -P 0x11 4M 1M' \ 148 147 -c 'read -P 0 5M 1M' \ 149 148 -f raw "$TEST_IMG.data" | ··· 180 179 -f $IMGFMT "$TEST_IMG" | 181 180 _filter_qemu_io 182 181 182 + # Discarded clusters are only marked as such in the qcow2 metadata, but 183 + # they can contain stale data in the external data file. Instead, zero 184 + # clusters must be zeroed in the external data file too. 183 185 echo 184 - $QEMU_IMG compare "$TEST_IMG" "$TEST_IMG.data" 186 + $QEMU_IO -c 'read -P 0 0 1M' \ 187 + -c 'read -P 0x11 1M 1M' \ 188 + -c 'read -P 0 3M 3M' \ 189 + -f raw "$TEST_IMG".data | 190 + _filter_qemu_io 185 191 186 192 echo -n "qcow2 file size after I/O: " 187 193 du -b $TEST_IMG | cut -f1
+6 -3
tests/qemu-iotests/244.out
··· 74 74 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 75 75 read 1048576/1048576 bytes at offset 1048576 76 76 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 77 - read 2097152/2097152 bytes at offset 2097152 78 - 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 79 77 read 1048576/1048576 bytes at offset 4194304 80 78 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 81 79 read 1048576/1048576 bytes at offset 5242880 ··· 108 106 read 4194304/4194304 bytes at offset 2097152 109 107 4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 110 108 111 - Images are identical. 109 + read 1048576/1048576 bytes at offset 0 110 + 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 111 + read 1048576/1048576 bytes at offset 1048576 112 + 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 113 + read 3145728/3145728 bytes at offset 3145728 114 + 3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 112 115 qcow2 file size after I/O: 327680 113 116 114 117 === bdrv_co_block_status test for file and offset=0 ===