From: "Denis V. Lunev" <den@openvz.org>
To: svt-core@virtuozzo.com
Cc: andrey.drobyshev@virtuozzo.com, den@openvz.org
Subject: [PATCH hci-8.0 3/5] iotests/nbd-commands: exercise the simple and structured reply modes #VSTOR-119829
Date: Mon, 31 Aug 2026 17:25:26 +0200 [thread overview]
Message-ID: <20260831152528.1350583-4-den@openvz.org> (raw)
In-Reply-To: <20260831152528.1350583-1-den@openvz.org>
From: Denis V. Lunev <den@openvz.org>
Every NBD request the iotests send arrives in NBD_MODE_EXTENDED, so
the server paths kept for older clients are never taken. Instrumenting
nbd_co_receive_request() over the whole auto group and every test that
touches NBD gives mode 4 for all of them, which leaves
nbd_co_send_simple_reply() and the compact header handling dead under
test. A regression there would only show against a third party client.
libnbd can negotiate down, so run the same command set three times,
once per mode, and assert the mode that was actually reached. Block
status is limited to the two modes that can negotiate a meta context.
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Eric Blake <eblake@redhat.com>
Message-ID: <20260827161002.310688-4-den@openvz.org>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
tests/qemu-iotests/tests/nbd-commands | 29 +++++++++++++++++++++++
tests/qemu-iotests/tests/nbd-commands.out | 4 ++--
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/tests/nbd-commands b/tests/qemu-iotests/tests/nbd-commands
index cbfc47782ff..3dfe9131900 100755
--- a/tests/qemu-iotests/tests/nbd-commands
+++ b/tests/qemu-iotests/tests/nbd-commands
@@ -119,6 +119,35 @@ class TestNbdCommands(iotests.QMPTestCase):
self.assertEqual(self.top_extents(), [(0, size, 0)])
qemu_io('-c', f'read -P {pattern} 0 {size}', top)
+ def check_commands(self, structured, extended):
+ self.connect(structured, extended)
+
+ self.assertEqual(self.h.pread(4096, 4096), bytes([pattern]) * 4096)
+
+ self.h.cache(size, 0)
+
+ self.h.pwrite(b'x' * 4096, 4096)
+ self.h.flush()
+ self.assertEqual(self.h.pread(4096, 4096), b'x' * 4096)
+
+ self.h.zero(4096, 8192)
+ self.assertEqual(self.h.pread(4096, 8192), bytes(4096))
+
+ self.h.trim(4096, 16384)
+
+ if structured:
+ self.assertEqual(self.block_status()['qemu:allocation-depth'],
+ [(size, DEPTH_LOCAL)])
+
+ def test_commands_simple_replies(self):
+ self.check_commands(structured=False, extended=False)
+
+ def test_commands_structured_replies(self):
+ self.check_commands(structured=True, extended=False)
+
+ def test_commands_extended_headers(self):
+ self.check_commands(structured=True, extended=True)
+
def test_cache_past_end_of_export(self):
self.assertRaises(nbd.Error, self.h.cache, size + 1, 0)
diff --git a/tests/qemu-iotests/tests/nbd-commands.out b/tests/qemu-iotests/tests/nbd-commands.out
index 8d7e9967009..3f8a935a082 100644
--- a/tests/qemu-iotests/tests/nbd-commands.out
+++ b/tests/qemu-iotests/tests/nbd-commands.out
@@ -1,5 +1,5 @@
-...
+......
----------------------------------------------------------------------
-Ran 3 tests
+Ran 6 tests
OK
--
2.53.0
next prev parent reply other threads:[~2026-08-31 15:25 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 ` Denis V. Lunev [this message]
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 ` [QEMU HCI-8.0 PATCH 6/5] VZ: iotests/nbd-commands: do not depend on cluster allocation order #VSTOR-119829 Andrey Drobyshev
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=20260831152528.1350583-4-den@openvz.org \
--to=den@openvz.org \
--cc=andrey.drobyshev@virtuozzo.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox