From: Markus Armbruster <armbru@pond.sub.org>
To: Guillaume Vincke <guillaume.vincke@ovhcloud.com>
Cc: <qemu-devel@nongnu.org>, <qemu-block@nongnu.org>,
<eblake@redhat.com>, <vsementsov@yandex-team.ru>,
<kwolf@redhat.com>, <hreitz@redhat.com>, <armbru@redhat.com>
Subject: Re: [PATCH v2 1/2] nbd: Add an unstable query for the client state
Date: Mon, 16 Nov 2026 11:39:01 +0100 [thread overview]
Message-ID: <875wxxqcvu.fsf@pond.sub.org> (raw)
In-Reply-To: <20261113140852.702959-2-guillaume.vincke@ovhcloud.com> (Guillaume Vincke's message of "Fri, 13 Nov 2026 15:08:51 +0100")
Guillaume Vincke <guillaume.vincke@ovhcloud.com> writes:
> 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.
>
> The next patch uses this command to make the nbd-stale-connection test
> deterministic.
>
> Signed-off-by: Guillaume Vincke <guillaume.vincke@ovhcloud.com>
[...]
> diff --git a/qapi/block-core.json b/qapi/block-core.json
> index 23c5787d99..0aa3ced3fe 100644
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -2217,6 +2217,93 @@
> 'features': [ 'unstable' ],
> 'allow-preconfig': true }
>
> +##
> +# @XDbgNbdClientState:
> +# An enumeration of NBD client states.
> +#
> +# @connecting-wait: No active connection. Reached when the client
> +# hits an I/O error. A request waits for the connection attempt
> +# to finish, while reconnect-delay has not expired.
> +#
> +# @connecting-nowait: No active connection. Reached when
> +# reconnect-delay expires. A request fails at once if no channel
> +# is ready.
> +#
> +# @connected: Client has a valid connection. Reached when a request
> +# gets a channel from the connector.
> +#
> +# @quit: Client stopped and will never reconnect. New requests
> +# fail. A running attempt or a parked channel stays until the
> +# node is closed. Reached on fatal error, teardown or yank.
> +#
> +# Since: 12.0
> +##
> +{ 'enum': 'XDbgNbdClientState',
> + 'data': [ 'connecting-wait', 'connecting-nowait', 'connected', 'quit' ] }
> +
> +##
> +# @XDbgNbdClientConnectorState:
> +# An enumeration of NBD client connector states.
> +#
> +# @idle: No connection attempt running and no parked channel. In
> +# 'connecting-wait' or 'connecting-nowait', the next request
> +# starts an attempt.
> +#
> +# @running: Connection attempt is in progress. A request waits or
> +# fails, as described in 'connecting-wait' and
> +# 'connecting-nowait'.
> +#
> +# @parked: Connection was successful and channel is kept. The next
> +# request takes the channel and the client goes to 'connected'.
> +#
> +# Since: 12.0
> +##
> +{ 'enum': 'XDbgNbdClientConnectorState',
> + 'data': [ 'idle', 'running', 'parked' ] }
> +
> +##
> +# @XDbgNbdClientConnector:
> +# The NBD connector information.
> +#
> +# @state: State of the connector.
> +#
> +# Since: 12.0
> +##
> +{ 'struct': 'XDbgNbdClientConnector',
> + 'data': { 'state': 'XDbgNbdClientConnectorState' } }
> +
> +##
> +# @XDbgNbdClient:
> +# The NBD connection state of the client and its connector.
> +#
> +# @state: The client state.
> +#
> +# @connector: The connector details.
> +#
> +# Since: 12.0
> +##
> +{ 'struct': 'XDbgNbdClient',
> + 'data': { 'state': 'XDbgNbdClientState',
> + 'connector': 'XDbgNbdClientConnector' } }
You got rid of "The two members are read independently and may not
reflect a single point in time." Good!
You also made @connector mandatory. I think that simplified things.
I could grill you some more on the state machine. Bah, the doc comemnts
are good enough for a testing / debugging command.
> +
> +##
> +# @x-debug-query-nbd-client:
> +# Get the NBD client state.
> +#
> +# @node-name: node name of a block node using the nbd driver.
> +# Use `query-named-block-nodes` to list block nodes.
> +#
> +# Features:
> +#
> +# @unstable: This command is meant for debugging and testing.
> +#
> +# Since: 12.0
> +##
> +{ 'command': 'x-debug-query-nbd-client',
> + 'data': { 'node-name': 'str' },
> + 'returns': 'XDbgNbdClient',
> + 'features': [ 'unstable' ] }
> +
> ##
> # @drive-mirror:
> # Start mirroring a block device's writes to a new destination.
QAPI schema
Acked-by: Markus Armbruster <armbru@redhat.com>
next prev parent reply other threads:[~2026-11-16 10:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 14:08 [PATCH v2 0/2] nbd: Add an unstable query for the client state Guillaume Vincke
2026-11-13 14:08 ` [PATCH v2 1/2] " Guillaume Vincke
2026-11-16 10:39 ` Markus Armbruster [this message]
2026-11-13 14:08 ` [PATCH v2 2/2] iotests: Make nbd-stale-connection test deterministic Guillaume Vincke
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=875wxxqcvu.fsf@pond.sub.org \
--to=armbru@pond.sub.org \
--cc=armbru@redhat.com \
--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.