qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Corey Minyard <cminyard@mvista.com>
Cc: bcketchum@gmail.com, hwd@huawei.com, qemu-devel@nongnu.org,
	afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH 2/7] qemu-char: Allow a chardev to reconnect if disconnected
Date: Thu, 6 Mar 2014 20:43:27 +0200	[thread overview]
Message-ID: <20140306184327.GB29043@redhat.com> (raw)
In-Reply-To: <5318B8A8.2060107@mvista.com>

On Thu, Mar 06, 2014 at 12:04:24PM -0600, Corey Minyard wrote:
> On 03/06/2014 01:43 AM, Michael S. Tsirkin wrote:
> >  
> > +@option{reconnect} specifies that if the client socket does not connect at
> > +startup, or if the client socket is closed for some reason (like the other
> > +end exited), wait the given number of seconds and attempt to reconnect.
> > +
> >  TCP and unix socket options are given below:
> >  
> >  @table @option
> > This looks useful but it bothers me that this
> > new option can't be used together with others:
> > server and nowait, which limits its usefulness
> > and would make it harder to extend in the future.
> >
> > - I think that specifying a time-out should be separate from the option to
> > retry.
> > E.g. it might be quite reasonable to retry connecting immediately.
> 
> Maybe, but that would basically disable qemu until the connection came
> back, because it would just be spinning trying to connect.

Why spin? queue the request in bh.

>  That doesn't
> seem like a good idea to me.
> 
> > - it seems to me that if we don't specify nowait, this
> > should stop the VM until reconnect.
> 
> That's an interesting thought.  Currently the option basically implies
> nowait.  It's probably easy to add this, but I'm not sure of the use
> case.

To avoid losing information that would have been sent there.

>  Anyone else have any opinions on this?
> 
> > - I think this can co-exist with server option.
> > E.g. if we detect that the other side closed the socket,
> > start listening again. Or even listen all the time
> > and accept if disconnected.
> 
> IIRC, that's what it does already, even without this patch.  If in
> server mode, I believe you can disconnect and then reconnect a socket
> and it works fine.  So I see no need for this function in server mode.
> 
> >
> > I'd like to suggest we generalize this a bit:
> >
> > When we detect a disconnect, three thinkable things to
> > do would be:
> >     - keep going as if nothing happened
> >         (default for all sockets except monitor)
> >     - exit qemu
> >         (default for monitor)
> >     - retry
> There's also
>     - stop the VM until the socket reconnects.
> 
> I'm not sure why you would want to single out monitor as special. 
> Especially if it is mux-ed into another connection.

it seems useful to make qemu exit when monitor
closes. many programs behave this way, this
makes sure if you lose connection,
the server does not hang around doing nothing.
combine with keepalive socket option,
you get a way to make qemu exit if it loses
networking, which just might help restore networking.

> >
> > When waiting for retry it seems reasonable to
> > either stop the VM or keep going (nowait option).
> >
> > When retrying, it seems reasonable to specify a
> > timeout to make it fail.
> 
> I just don't see why you would want to do this.  It means that the
> connection is gone until the VM starts back up again.

e.g. if socket is used for serial, you might want to stop
VM to avoid losing output.

> One thing I did think of was to add a monitor command to try to
> reconnect.  Then I could understand giving up, since you can get into
> the monitor and kick it back off.
> 
> Thanks,
> 
> -corey
> 

if qemu exits on timeout, then that's also useful
as a way of automatically cleaning up resources
if you lose connection to qemu.
which might help host recover from e.g. oom
situation, and become responsive again.


> > All of the above seem to apply to server
> > and client sockets, with or without nowait option.
> >
> > For clients only, it might be somewhat useful to
> > limit the network traffic caused by reconnects.
> >
> > Thanks,
> > MST
> >
> >> -- 
> >> 1.8.3.1

  reply	other threads:[~2014-03-06 19:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-05  0:38 [Qemu-devel] [PATCH 0/7] Allow a client chardev to reconnect if disconnected minyard
2014-03-05  0:38 ` [Qemu-devel] [PATCH 1/7] qemu-char: Allocate CharDriverState in qemu_chr_new_from_opts minyard
2014-03-05  0:38 ` [Qemu-devel] [PATCH 2/7] qemu-char: Allow a chardev to reconnect if disconnected minyard
2014-03-06  6:47   ` Weidong Huang
2014-03-06 17:18     ` Corey Minyard
2014-03-06 17:41       ` Michael S. Tsirkin
2014-03-06  7:43   ` Michael S. Tsirkin
2014-03-06 18:04     ` Corey Minyard
2014-03-06 18:43       ` Michael S. Tsirkin [this message]
2014-03-05  0:38 ` [Qemu-devel] [PATCH 3/7] qemu-char: Wait until socket connect to report connected minyard
2014-03-05  0:38 ` [Qemu-devel] [PATCH 4/7] qemu-char: remove free of chr from win_stdio_close minyard
2014-03-05  0:38 ` [Qemu-devel] [PATCH 5/7] qemu-char: Close fd at end of file minyard
2014-03-05  0:38 ` [Qemu-devel] [PATCH 6/7] qemu-char: Clean up error handling in qmp_chardev_add minyard
2014-03-05  0:38 ` [Qemu-devel] [PATCH 7/7] console: Don't use the console if NULL minyard

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=20140306184327.GB29043@redhat.com \
    --to=mst@redhat.com \
    --cc=afaerber@suse.de \
    --cc=bcketchum@gmail.com \
    --cc=cminyard@mvista.com \
    --cc=hwd@huawei.com \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).