On Fri, May 30, 2025 at 05:12:35PM -0500, Eric Blake via Libguestfs wrote:
This is in response to https://gitlab.com/nbdkit/libnbd/-/issues/12 where nbdinfo is having a hard time because nbdkit is outputting data that is not in compliance with the current NBD spec (which states that if client and server agreed on a minimum blocksize, then extents must be aligned to that).
I still have more to write: - add a unit test for the server change at 4G (in addition to the unit test I got working for blocksize-policy tripping on the same problem with a much smaller unaligned-size data image) - libnbd: patch nbdinfo to tolerate unaligned extents from the server. Even if the spec says its wrong, existing servers in the wild do it, so we should be tolerant. - upstream NBD spec: propose weakening the standard from SHALL to SHOULD provide aligned extents - blocksize-policy: Consider patches to allow aligned offset but unaligned length IF the length extends from offset to the end of the unaligned-size disk. Document that an unaligned tail is hard to read, and suggest use of the truncate filter to deal with it.
I've moved this to a gitlab merge request while I continue to refine the series: https://gitlab.com/nbdkit/nbdkit/-/merge_requests/97
But as this has taken me the better part of today, I wanted to put out what I have so far.
Eric Blake (4): human-size: Add human_size_parse_substr data: Allow scaling suffixes on @decimal blocksize-policy: Round extents to match minimum alignment server: Align the truncation of large block_status results
plugins/data/nbdkit-data-plugin.pod | 3 +- tests/Makefile.am | 2 + common/include/human-size-test-cases.h | 83 ++++++++++-------- common/include/human-size.h | 57 ++++++++---- common/include/test-human-size.c | 52 +++++++++-- server/protocol.c | 12 ++- server/test-public.c | 13 +-- plugins/data/format.c | 115 ++++++++++++------------- filters/blocksize-policy/policy.c | 15 +++- tests/test-data-format.sh | 8 +- tests/test-eval-extents.sh | 6 +- 11 files changed, 230 insertions(+), 136 deletions(-)
In particular, my emails forgot to add the new tests/test-blocksize-policy-extents.sh file before committing. -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org