qemu-e2k/tests
Nir Soffer 0da9856851 nbd: server: Report holes for raw images
When querying image extents for raw image, qemu-nbd reports holes as
zero:

$ qemu-nbd -t -r -f raw empty-6g.raw

$ qemu-img map --output json nbd://localhost
[{ "start": 0, "length": 6442450944, "depth": 0, "zero": true, "data": true, "offset": 0}]

$ qemu-img map --output json empty-6g.raw
[{ "start": 0, "length": 6442450944, "depth": 0, "zero": true, "data": false, "offset": 0}]

Turns out that qemu-img map reports a hole based on BDRV_BLOCK_DATA, but
nbd server reports a hole based on BDRV_BLOCK_ALLOCATED.

The NBD protocol says:

    NBD_STATE_HOLE (bit 0): if set, the block represents a hole (and
    future writes to that area may cause fragmentation or encounter an
    NBD_ENOSPC error); if clear, the block is allocated or the server
    could not otherwise determine its status.

qemu-img manual says:

    whether the sectors contain actual data or not (boolean field data;
    if false, the sectors are either unallocated or stored as
    optimized all-zero clusters);

To me, data=false looks compatible with NBD_STATE_HOLE. From user point
of view, getting same results from qemu-nbd and qemu-img is more
important than being more correct about allocation status.

Changing nbd server to report holes using BDRV_BLOCK_DATA makes qemu-nbd
results compatible with qemu-img map:

$ qemu-img map --output json nbd://localhost
[{ "start": 0, "length": 6442450944, "depth": 0, "zero": true, "data": false, "offset": 0}]

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Message-Id: <20210219160752.1826830-1-nsoffer@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2021-03-08 13:08:45 -06:00
..
acceptance tests/acceptance: allow a "graceful" failing for virtio-gpu test 2021-02-24 11:05:14 +00:00
data qtest/acpi/bios-tables-test: update acpi tables 2021-02-23 10:58:42 -05:00
decode
docker docker: Bump Fedora images to release 33 2021-02-24 11:05:10 +00:00
fp meson: adjust timeouts for some slower tests 2021-03-06 11:42:57 +01:00
guest-debug chardev: do not use short form boolean options in non-QemuOpts character device descriptions 2021-02-25 15:41:53 +01:00
image-fuzzer
include
keys
migration
multiboot
perf/block/qcow2
plugin tests/plugin: allow memory plugin to do both inline and callbacks 2021-02-18 08:19:23 +00:00
qapi-schema qapi: Fix parse errors for removal of null from schema language 2021-03-05 15:40:50 +01:00
qemu-iotests nbd: server: Report holes for raw images 2021-03-08 13:08:45 -06:00
qtest * fix tracing vs -daemonize (Daniel) 2021-03-08 13:51:41 +00:00
rocker
tcg meson.build: expose TCG cross compiler information in summary 2021-02-24 11:05:05 +00:00
tsan
uefi-test-tools
vm
vmstate-static-checker-data
atomic64-bench.c
atomic_add-bench.c
benchmark-crypto-cipher.c
benchmark-crypto-hash.c
benchmark-crypto-hmac.c
check-block-qdict.c
check-block.sh
check-qdict.c
check-qjson.c
check-qlist.c
check-qlit.c
check-qnull.c
check-qnum.c
check-qobject.c
check-qom-interface.c
check-qom-proplist.c
check-qstring.c
crypto-tls-psk-helpers.c
crypto-tls-psk-helpers.h
crypto-tls-x509-helpers.c
crypto-tls-x509-helpers.h
dbus-vmstate-daemon.sh
io-channel-helpers.c
io-channel-helpers.h
iothread.c
iothread.h
Makefile.include tests/Makefile.include: don't use TARGET_DIRS for check-tcg 2021-02-08 10:55:20 +00:00
meson.build meson: adjust timeouts for some slower tests 2021-03-06 11:42:57 +01:00
pkix_asn1_tab.c
ptimer-test-stubs.c
ptimer-test.c
ptimer-test.h
qht-bench.c
rcutorture.c
requirements.txt Acceptance Tests: bump Avocado version requirement to 85.0 2021-02-15 18:56:57 -05:00
socket-helpers.c
socket-helpers.h
test-aio-multithread.c
test-aio.c
test-authz-list.c
test-authz-listfile.c
test-authz-pam.c
test-authz-simple.c
test-base64.c test: Fix LGPL information in the file headers 2020-11-15 17:04:40 +01:00
test-bdrv-drain.c
test-bdrv-graph-mod.c block: use return status of bdrv_append() 2021-02-12 15:39:44 -06:00
test-bitcnt.c
test-bitmap.c
test-bitops.c
test-block-backend.c
test-block-iothread.c
test-blockjob-txn.c
test-blockjob.c
test-bufferiszero.c
test-char.c docs: update to show preferred boolean syntax for -chardev 2021-02-25 14:14:33 +01:00
test-clone-visitor.c
test-coroutine.c
test-crypto-afsplit.c
test-crypto-block.c
test-crypto-cipher.c
test-crypto-hash.c
test-crypto-hmac.c
test-crypto-ivgen.c
test-crypto-pbkdf.c
test-crypto-secret.c
test-crypto-tlscredsx509.c
test-crypto-tlssession.c
test-crypto-xts.c
test-cutils.c
test-fdmon-epoll.c
test-hbitmap.c
test-image-locking.c
test-int128.c
test-io-channel-buffer.c
test-io-channel-command.c
test-io-channel-file.c
test-io-channel-socket.c
test-io-channel-tls.c
test-io-task.c
test-iov.c
test-keyval.c
test-logging.c
test-mul64.c
test-opts-visitor.c
test-qapi-util.c
test-qdev-global-props.c
test-qdist.c
test-qemu-opts.c
test-qga.c
test-qgraph.c
test-qht-par.c
test-qht.c
test-qmp-cmds.c
test-qmp-event.c
test-qobject-input-visitor.c
test-qobject-output-visitor.c
test-rcu-list.c
test-rcu-simpleq.c
test-rcu-slist.c
test-rcu-tailq.c
test-replication.c
test-shift128.c
test-string-input-visitor.c
test-string-output-visitor.c
test-thread-pool.c
test-throttle.c
test-timed-average.c
test-util-filemonitor.c
test-util-sockets.c
test-uuid.c
test-visitor-serialization.c
test-vmstate.c
test-write-threshold.c block: refactor bdrv_check_request: add errp 2021-02-03 08:00:33 -06:00
test-x86-cpuid.c
test-xbzrle.c
vhost-user-bridge.c