Based-on: <[email protected]> These changes follow the discussion on: https://patchew.org/QEMU/[email protected]/#[email protected] 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/[email protected] 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. Guillaume Vincke (2): nbd: Add an unstable query for the client state iotests: Make nbd-stale-connection test deterministic block/nbd.c | 57 ++++++++++++ include/block/nbd.h | 9 ++ nbd/client-connection.c | 22 +++++ qapi/block-core.json | 87 +++++++++++++++++++ tests/qemu-iotests/tests/nbd-stale-connection | 17 ++-- 5 files changed, 187 insertions(+), 5 deletions(-) -- 2.43.0
