net: add explicit info about connecting/listening state
commitcc91ca64d826acc0214ebf9428f5130b37deecd8
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 4 Jan 2024 16:29:40 +0000 (4 16:29 +0000)
committerThomas Huth <thuth@redhat.com>
Thu, 11 Jan 2024 10:39:26 +0000 (11 11:39 +0100)
tree69b3c97341f7db6f740848a518de737a93b467fd
parenta298293866b277cb40ab24dcedda36c2b89ed2ab
net: add explicit info about connecting/listening state

When running 'info network', if the stream backend is still in
the process of connecting, or waiting for an incoming connection,
no information is displayed.

There is also no way to distinguish whether the server is still
in the process of setting up the listener socket, or whether it
is ready to accept incoming client connections.

This leads to a race condition in the netdev-socket qtest which
launches a server process followed by a client process. Under
high load conditions it is possible for the client to attempt
to connect before the server is accepting clients. For the
scenarios which do not set the 'reconnect' option, this opens
up a race which can lead to the test scenario failing to reach
the expected state.

Now that 'info network' can distinguish between initialization
phase and the listening phase, the netdev-socket qtest will
correctly synchronize, such that the client QEMU is not spawned
until the server is ready.

This should solve the non-deterministic failures seen with the
netdev-socket qtest.

Signed-off-by: "Daniel P. Berrangé" <berrange@redhat.com>
Message-ID: <20240104162942.211458-5-berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
net/stream.c
tests/qtest/netdev-socket.c