From: Markus Armbruster <armbru@pond.sub.org>
To: Eric Blake <eblake@redhat.com>
Cc: guillaume vincke <guillaume.vincke@ovhcloud.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org,
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>,
Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
Subject: Re: [PATCH v3 1/2] nbd: Add an unstable query for the client state
Date: Wed, 02 Dec 2026 09:37:58 +0100 [thread overview]
Message-ID: <87v75cdqmx.fsf@pond.sub.org> (raw)
In-Reply-To: <aw8CmBdg3a-mkbl1@redhat.com> (Eric Blake's message of "Tue, 1 Dec 2026 11:26:35 -0600")
Eric Blake <eblake@redhat.com> writes:
> On Tue, Dec 01, 2026 at 06:08:33PM +0100, guillaume vincke wrote:
>> On 12/1/26 15:59, Eric Blake wrote:
>> > On Mon, Nov 30, 2026 at 12:13:26PM +0100, Guillaume Vincke wrote:
>> > > At the moment, NBD client internals cannot be accessed. Therefore,
>> > > tests have to infer the client state from I/O results and wait with
>> > > sleeps, which is racy.
>> > >
>> > > Add the x-debug-query-nbd-client QMP command that reports the state of
>> > > the client's connection and of its connector. Other fields will be
>> > > added when needed.
>> > >
>> > > Signed-off-by: Guillaume Vincke <guillaume.vincke@ovhcloud.com>
>> > > Acked-by: Markus Armbruster <armbru@redhat.com>
>> > > ---
>> > > qapi/block-core.json | 87 +++++++++++++++++++++++++++++++++++++++++
>> > > include/block/nbd.h | 9 +++++
>> > > block/nbd.c | 57 +++++++++++++++++++++++++++
>> > > nbd/client-connection.c | 22 +++++++++++
>> > > 4 files changed, 175 insertions(+)
>> > >
>> >
>> > > +++ b/qapi/block-core.json
>> >
>> > > +##
>> > > +{ 'enum': 'XDbgNbdClientConnectorState',
>> > > + 'data': [ 'idle', 'running', 'parked' ] }
>> >
>> > QAPI gives us an enum,...
>> >
>> > > +++ b/include/block/nbd.h
>> > > @@ -492,6 +492,15 @@ const char *nbd_mode_lookup(NBDMode mode);
>> > > /* nbd/client-connection.c */
>> > > void nbd_client_connection_enable_retry(NBDClientConnection *conn);
>> > > +typedef enum NBDClientConnectionThreadState {
>> > > + NBD_CLIENT_CONNECTION_THREAD_IDLE,
>> > > + NBD_CLIENT_CONNECTION_THREAD_RUNNING,
>> > > + NBD_CLIENT_CONNECTION_THREAD_PARKED,
>> > > +} NBDClientConnectionThreadState;
>> >
>> > ...but you are defining yet another one with similar naming. Is there
>> > a reason we can't reuse the generated enum from QAPI?
Eric has a point there. I didn't see this because I only looked at the
QAPI schema.
>> My goal was to be consistent for both enums and decided to go with the
>> extra one. I will remove it in v4.
>>
>
>> > > + case NBD_CLIENT_QUIT:
>> > > + info->state = XDBG_NBD_CLIENT_STATE_QUIT;
>> > > + break;
>> > > + }
>> >
>> > Another example of mapping between an existing enum and a
>> > QAPI-generated one; would it be smarter to just use the QAPI-generated
>> > one everywhere? Although in that case, we would want naming better
>> > than the XDBG_ prefix.
>>
>> I'd be happy to replace the NBDClientState with the QAPI enum if you
>> think the XDBG prefix can be removed.
>> Markus, would that be acceptable for the QAPI schema ?
>
> The type names in QAPI are flexible and don't get exposed to the end
> user over introspection.
Correct.
> I get why you initially used the XDbg prefix
> on the types, to make it easier to match the x-debug- command you
> added; but unless Markus sees a problem that I'm overlooking, there's
> nothing that prevents you from just naming the new enum type
> NbdClientConnectorState instead of XDbgNbdClientConnectorState, since
> you would then be using the type in more use cases than just the
> x-debug- command.
Renaming types is fine. Use the type name that makes the most sense.
next prev parent reply other threads:[~2026-12-02 8:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 11:13 [PATCH v3 0/2] nbd: Add an unstable query for the client state Guillaume Vincke
2026-11-30 11:13 ` [PATCH v3 1/2] " Guillaume Vincke
2026-12-01 14:59 ` Eric Blake
2026-12-01 17:08 ` guillaume vincke
2026-12-01 17:26 ` Eric Blake
2026-12-02 8:37 ` Markus Armbruster [this message]
2026-11-30 11:13 ` [PATCH v3 2/2] iotests: Add coverage for x-debug-query-nbd-client QMP command Guillaume Vincke
2026-12-01 15:39 ` Eric Blake
2026-12-01 16:57 ` guillaume vincke
2026-12-01 17:28 ` Eric Blake
2026-12-01 16:32 ` Eric Blake
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=87v75cdqmx.fsf@pond.sub.org \
--to=armbru@pond.sub.org \
--cc=eblake@redhat.com \
--cc=guillaume.vincke@ovhcloud.com \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@yandex-team.ru \
/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.