These changes follow the discussion on:
https://patchew.org/QEMU/20261105164124.249395-1-guillaume.vincke@ovhcloud.com/#au4tsMuhKjq62dVB@redhat.com
Even though Eric Blake suggested a query for NBD server state,
considering the nbd-stale-connection test we are trying to make
deterministic relies on qemu-nbd, which does not have QMP, this
patchset adds a command to query the NBD client state.
The created QMP command output lists the client internals. The
connector field is used to give the NBD client connection thread
details, i.e. when idle, running or when a channel is ready to be
picked up. Other fields such as in-flight or negotiated size can easily
be added at the top level while others like the connector's last error
would be added into the connector one.
Considering this command accesses the client's private state, it is
implemented in block/nbd.c where BDRVNBDState is defined.
v1: https://patchew.org/QEMU/20261109160609.1434289-1-guillaume.vincke@ovhcloud.com
v2: https://patchew.org/QEMU/20261113140852.702959-1-guillaume.vincke@ovhcloud.com
v3: https://patchew.org/QEMU/20261130111327.178850-1-guillaume.vincke@ovhcloud.com
v1 -> v2:
- patch 1: Connector is now always present, with an idle state. Read
client and connector states under the same lock. Add the NBD state
information to the QMP documentation. Fix documentation wording and
version number.
- patch 2: Simplify the connector lookup using the new QMP command
output.
v2 -> v3:
- Break dependency on <20261105164124.249395-1-guillaume.vincke@ovhcloud.com>
- patch 1: Add Markus Armbruster's Acked-by
- patch 2: Replace the integration into an existing test with a new one
covering the command capabilities. nbd-stale-connection changes move
to its own v4 patchset.
v3 -> v4:
- patch 1: Drop the XDbg prefix from enum types and use them
internally. Kept Markus's Acked-by as he validated the change.
- patch 2: Yank the node to move the client into the "quit" state.
Guillaume Vincke (2):
nbd: Add an unstable query for the client state
iotests: Add coverage for x-debug-query-nbd-client QMP command
qapi/block-core.json | 87 +++++++++++++++++++
include/block/nbd.h | 4 +
block/nbd.c | 84 +++++++++++-------
nbd/client-connection.c | 22 +++++
tests/qemu-iotests/tests/nbd-client-query | 78 +++++++++++++++++
tests/qemu-iotests/tests/nbd-client-query.out | 15 ++++
6 files changed, 261 insertions(+), 29 deletions(-)
create mode 100755 tests/qemu-iotests/tests/nbd-client-query
create mode 100644 tests/qemu-iotests/tests/nbd-client-query.out
base-commit: fbb87b0d358a3e8ab11d59bcdf80ac34c97f6e3e
--
2.43.0