All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v2] qga: add systemd socket activation support
Date: Fri, 6 Jan 2017 15:34:23 +0000	[thread overview]
Message-ID: <20170106153423.GQ31112@redhat.com> (raw)
In-Reply-To: <20170106152930.6779-1-stefanha@redhat.com>

On Fri, Jan 06, 2017 at 03:29:30PM +0000, Stefan Hajnoczi wrote:
> AF_UNIX and AF_VSOCK listen sockets can be passed in by systemd on
> startup.  This allows systemd to manage the listen socket until the
> first client connects and between restarts.  Advantages of socket
> activation are that parallel startup of network services becomes
> possible and that unused daemons do not consume memory.
> 
> The key to achieving this is the LISTEN_FDS environment variable, which
> is a stable ABI as shown here:
> https://www.freedesktop.org/wiki/Software/systemd/InterfacePortabilityAndStabilityChart/
> 
> We could link against libsystemd and use sd_listen_fds(3) but it's easy
> to implement the tiny LISTEN_FDS ABI so that qemu-ga does not depend on
> libsystemd.  Some systems may not have systemd installed and wish to
> avoid the dependency.  Other init systems or socket activation servers
> may implement the same ABI without systemd involvement.
> 
> Test as follows:
> 
>   $ cat ~/.config/systemd/user/qga.service
>   [Unit]
>   Description=qga
> 
>   [Service]
>   WorkingDirectory=/tmp
>   ExecStart=/path/to/qemu-ga --logfile=/tmp/qga.log --pidfile=/tmp/qga.pid --statedir=/tmp
> 
>   $ cat ~/.config/systemd/user/qga.socket
>   [Socket]
>   ListenStream=/tmp/qga.sock
> 
>   [Install]
>   WantedBy=default.target
> 
>   $ systemctl --user daemon-reload
>   $ systemctl --user start qga.socket
>   $ nc -U /tmp/qga.sock
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> v2:
>  * Drop libsystemd dependency [danpb]
> 
>  qga/channel.h       |  3 ++-
>  qga/channel-posix.c | 66 ++++++++++++++++++++++++++---------------------
>  qga/channel-win32.c |  2 +-
>  qga/main.c          | 74 +++++++++++++++++++++++++++++++++++++++++++++++++----
>  4 files changed, 109 insertions(+), 36 deletions(-)

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>



Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

  reply	other threads:[~2017-01-06 15:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-06 15:29 [Qemu-devel] [PATCH v2] qga: add systemd socket activation support Stefan Hajnoczi
2017-01-06 15:34 ` Daniel P. Berrange [this message]
2017-01-12 14:43 ` Stefan Hajnoczi

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=20170106153423.GQ31112@redhat.com \
    --to=berrange@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.