From: Eric Blake <eblake@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 2/2] char: allow passing pre-opened socket file descriptor at startup
Date: Thu, 21 Dec 2017 12:56:10 -0600 [thread overview]
Message-ID: <bb5ebf8c-64f4-15b5-ec1b-3788e87be2ca@redhat.com> (raw)
In-Reply-To: <20171221155905.3793-3-berrange@redhat.com>
On 12/21/2017 09:59 AM, Daniel P. Berrange wrote:
> When starting QEMU management apps will usually setup a monitor socket, and
> then open it immediately after startup. If not using QEMU's own -daemonize
> arg, this process can be troublesome to handle correctly. The mgmt app will
> need to repeatedly call connect() until it succeeds, because it does not
> know when QEMU has created the listener socket. If can't retry connect()
> forever though, because an error might have caused QEMU to exit before it
> even creates the monitor.
>
> The obvious way to fix this kind of problem is to just pass in a pre-opened
> socket file descriptor for the QEMU monitor to listen on. The management app
> can now immediately call connect() just once. If connect() fails it knows
> that QEMU has exited with an error.
>
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
> chardev/char-socket.c | 32 ++++++++--
> chardev/char.c | 3 +
> tests/test-char.c | 173 +++++++++++++++++++++++++++++++++++++++++++++++++-
> util/qemu-sockets.c | 42 +++++++++++-
> 4 files changed, 238 insertions(+), 12 deletions(-)
>
> @@ -983,25 +984,36 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend,
> const char *path = qemu_opt_get(opts, "path");
> const char *host = qemu_opt_get(opts, "host");
> const char *port = qemu_opt_get(opts, "port");
> + const char *fd = qemu_opt_get(opts, "fd");
> const char *tls_creds = qemu_opt_get(opts, "tls-creds");
> SocketAddressLegacy *addr;
> ChardevSocket *sock;
>
> + if ((!!path + !!fd + !!host) != 1) {
I see you liked my suggestion for a compact rendering; the resulting
line has more symbols than it does alphanumerics ;)
> +/* Syms in libqemustub.a are discarded at .o file granularity.
> + * To replace monitor_get_fd() we must ensure everything in
> + * stubs/monitor.c is defined, to make sure monitor.o is discarded
> + * otherwise we get duplicate syms at link time.
> + */
> +Monitor *cur_mon = NULL;
Patchew is correct that you can omit the ' = NULL'.
With that tweaked,
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2017-12-21 18:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-21 15:59 [Qemu-devel] [PATCH v2 0/2] Enable passing pre-opened chardev socket FDs Daniel P. Berrange
2017-12-21 15:59 ` [Qemu-devel] [PATCH v2 1/2] io: move fd_is_socket() into common sockets code Daniel P. Berrange
2017-12-21 18:47 ` Eric Blake
2017-12-22 8:55 ` Markus Armbruster
2017-12-22 10:57 ` Daniel P. Berrange
2017-12-21 15:59 ` [Qemu-devel] [PATCH v2 2/2] char: allow passing pre-opened socket file descriptor at startup Daniel P. Berrange
2017-12-21 18:56 ` Eric Blake [this message]
2017-12-22 10:06 ` Markus Armbruster
2017-12-22 10:26 ` Daniel P. Berrange
2017-12-22 13:21 ` Markus Armbruster
2017-12-21 16:17 ` [Qemu-devel] [PATCH v2 0/2] Enable passing pre-opened chardev socket FDs no-reply
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=bb5ebf8c-64f4-15b5-ec1b-3788e87be2ca@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.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).