qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] net: stream: add a new option to automatically reconnect


From: Daniel P . Berrangé
Subject: Re: [PATCH] net: stream: add a new option to automatically reconnect
Date: Thu, 10 Nov 2022 11:37:44 +0000
User-agent: Mutt/2.2.7 (2022-08-07)

On Thu, Nov 10, 2022 at 12:22:21PM +0100, Markus Armbruster wrote:
> Laurent Vivier <lvivier@redhat.com> writes:
> 
> > In stream mode, if the server shuts down there is currently
> > no way to reconnect the client to a new server without removing
> > the NIC device and the netdev backend (or to reboot).
> >
> > This patch introduces a reconnect option that specifies a delay
> > to try to reconnect with the same parameters.
> >
> > Add a new test in qtest to test the reconnect option and the
> > connect/disconnect events.
> >
> > Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> > ---
> 
> [...]
> 
> > diff --git a/qapi/net.json b/qapi/net.json
> > index 522ac582edeb..5b72c936b3ac 100644
> > --- a/qapi/net.json
> > +++ b/qapi/net.json
> > @@ -585,6 +585,9 @@
> >  # @addr: socket address to listen on (server=true)
> >  #        or connect to (server=false)
> >  # @server: create server socket (default: false)
> > +# @reconnect: For a client socket, if a socket is disconnected,
> > +#             then attempt a reconnect after the given number of seconds.
> > +#             Setting this to zero disables this function. (default: 0)
> 
> Double-checking: it attempts to reconnect *once*.  Correct?

Repeatedly.

IIUC, this doesn't just try to reconnect a failed connection, it'll
reconnect the initial connection if the server doesn't listen when
QEMU first startup.

> Are we sure multiples of seconds will be fine?

FWIW, this text & behaviour (AFAICT) is identical to the same named
option against ChardevSocket, which is good for consistency.

Since the reconnect is continuous until connected, you don't
want too frequent reconnects otherwise it'll burn CPU time.

That said, if it wasn't for the pre-existing chardev option,
I would have suggested milliseconds be worth considering as
units. Arguably it should probaby have an increasing backoff.

We could achieve that without changing semantics in a way that
would matter to apps, by declaring that 'reconnect' is the
maximum reconnect time. So start a reconnect at 50ms, 100ms,
200ms, 500ms, 1s, .... $reconnect

IOW, I think its okey to set reconnect units to seconds, and
we have the option to retrofit the fast start + backwoff
later.

> "For a client socket": what happens for a server socket?


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]