From: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
To: svt-core@virtuozzo.com
Cc: andrey.drobyshev@virtuozzo.com, den@openvz.org
Subject: [QEMU HCI-8.0 PATCH 6/5] VZ: iotests/nbd-commands: do not depend on cluster allocation order #VSTOR-119829
Date: Tue, 1 Sep 2026 18:50:47 +0300 [thread overview]
Message-ID: <20260901155047.461396-1-andrey.drobyshev@virtuozzo.com> (raw)
In-Reply-To: <20260831152528.1350583-1-den@openvz.org>
test_cache_copies_on_read compares qemu-img map output verbatim, but
map only merges neighbours that are contiguous in the image file. Our
copy-on-read runs its 16M chunks concurrently since ce4a1338cf7
("block/io: copy-on-read: use aio task pool"), so the two halves of
the 32M NBD_CMD_CACHE race for cluster allocation and flakily land in
the file in swapped order:
OK: {start: 0, length: 32M, depth: 0, offset: 327680}
FAIL: {start: 0, length: 16M, depth: 0, offset: 17104896}
{start: 16M, length: 16M, depth: 0, offset: 327680}
Same data, same depth, only the host offsets differ. Merge adjacent
extents of equal depth in top_extents() so that the test compares the
guest layout, not the file layout.
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
---
tests/qemu-iotests/tests/nbd-commands | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/tests/nbd-commands b/tests/qemu-iotests/tests/nbd-commands
index 4c1cd33db74..9a4a0d1ecd8 100755
--- a/tests/qemu-iotests/tests/nbd-commands
+++ b/tests/qemu-iotests/tests/nbd-commands
@@ -105,8 +105,17 @@ class TestNbdCommands(iotests.QMPTestCase):
"""Which parts of the top image are local, once qemu has let go."""
self.disconnect()
self.vm.shutdown()
- return [(e['start'], e['length'], e['depth'])
- for e in qemu_img_map(top)]
+ # Concurrent copy-on-read tasks may allocate clusters out of
+ # order, and qemu-img map does not merge neighbours that are
+ # discontiguous in the image file. Only the guest layout
+ # matters here, so merge adjacent extents of equal depth.
+ extents = []
+ for e in qemu_img_map(top):
+ if extents and extents[-1][2] == e['depth']:
+ extents[-1][1] += e['length']
+ else:
+ extents.append([e['start'], e['length'], e['depth']])
+ return [tuple(e) for e in extents]
def test_cache_copies_on_read(self):
maximum = self.h.get_block_size(nbd.SIZE_MAXIMUM)
--
2.47.1
prev parent reply other threads:[~2026-09-01 15:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 15:25 [PATCH hci-8.0 0/5] nbd/server: accept a large NBD_CMD_CACHE #VSTOR-119829 Denis V. Lunev
2026-08-31 15:25 ` [PATCH hci-8.0 1/5] iotests: add coverage for NBD transmission commands #VSTOR-119829 Denis V. Lunev
2026-09-01 15:51 ` Andrey Drobyshev
2026-08-31 15:25 ` [PATCH hci-8.0 2/5] nbd/server: accept NBD_CMD_CACHE above the maximum payload size #VSTOR-119829 Denis V. Lunev
2026-08-31 15:25 ` [PATCH hci-8.0 3/5] iotests/nbd-commands: exercise the simple and structured reply modes #VSTOR-119829 Denis V. Lunev
2026-08-31 15:25 ` [PATCH hci-8.0 4/5] iotests/nbd-commands: cover NBD_CMD_BLOCK_STATUS with a payload #VSTOR-119829 Denis V. Lunev
2026-08-31 15:25 ` [PATCH hci-8.0 5/5] iotests/nbd-commands: cover the command flags and sparse replies #VSTOR-119829 Denis V. Lunev
2026-09-01 15:50 ` Andrey Drobyshev [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260901155047.461396-1-andrey.drobyshev@virtuozzo.com \
--to=andrey.drobyshev@virtuozzo.com \
--cc=den@openvz.org \
--cc=svt-core@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.