xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <mcgrof@suse.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: xen-devel@lists.xenproject.org,
	"Luis R. Rodriguez" <mcgrof@do-not-panic.com>
Subject: Re: [PATCH v5 02/14] libxenstore.so: add support for	systemd
Date: Wed, 21 May 2014 19:15:21 +0200	[thread overview]
Message-ID: <20140521171521.GV13289@wotan.suse.de> (raw)
In-Reply-To: <1400690917.11409.14.camel@kazak.uk.xensource.com>

On Wed, May 21, 2014 at 05:48:37PM +0100, Ian Campbell wrote:
> On Wed, 2014-05-21 at 18:32 +0200, Luis R. Rodriguez wrote:
> > On Wed, May 21, 2014 at 03:56:54PM +0100, Ian Campbell wrote:
> > > On Wed, 2014-05-21 at 15:35 +0100, Ian Campbell wrote:
> > > 
> > > > > +
> > > > > +/*
> > > > > + * We list stdin, stdout and stderr simply for documentation purposes
> > > > > + * and to help our array size fit the number of expected sockets we
> > > > > + * as sd_listen_fds() will return 5 for example if you set the socket
> > > > > + * service with 2 sockets.
> > > > 
> > > > Please can we get rid of this list (which is bad enough in itself but
> > > > the three spurious entries are ludicrous) and just
> > > > #define SOCKET_RW_INDEX SD_LISTEN_FDS_START
> > > > #define SOCKET_RO_INDEX SDL_LISTEN_FDS_START + 1
> > > > etc and use those for lookups, as I described in
> > > > <1399971222.11314.27.camel@kazak.uk.xensource.com>?
> > > 
> > > Also I thought that we decided that the mapping from the indexes here to
> > > the functionality need to be documented as well, I'm not seeing that, at
> > > least not based on a skim of the other subject lines in this series.
> > 
> > I didn't like the #define approach
> 
> The indexes are into the systemd provided environment variable of the
> fds which it has produced for us. It *must* be documented what
> xenstored's expectations are wrt what is in that array. Non optional and
> completely orthogonal to the use of #defines or anything else.

Sure.

> >  so wanted to pitch it again under
> > new usage, I'll be sure to add something once a final approach is
> > decided.
> > 
> > Please note that another reason for tucking things away under a list
> > and library was to *eventually* remove the different definitions of
> > these socket's paths.
> 
> >  That code is already split up but can be brought
> > together under libxenstore and for the systemd case the list can be
> > used to to do an O(1) lookup of the socket path in the list. If we
> > use just #defines we would just be adding more #defines for other
> > things other than the file descriptor for systemd, we'd have it also
> > for mode, and paths. The list therefore seemed more attractive.
> 
> I'm afraid non of this makes any sense to me.
> 
> If this mad list of paths and indexes scheme is The Systemd Way then
> please provide references. Otherwise:
> 
> systemd case:
> 
>         int get_handle(int index)
>         {
>            return sd_listen_fds(index);

That's not the way to use sd_listen_fds(). More on this below.

>         }
>         
> no extra uses of the path or need for #defines for modes or anything
> like that.
> 
> non-systemd case:
>    switch(index)
>    case SOCKET_WR_INDEX:
>         open /var/run/xensotred/socket by whatever means.

The struct I defined is not something part of systemd, in fact there
are not many example codes out there that use multiple sockets but the
approach to use multiple sockets is to actually only call sd_listen_fds()
once. That returns the list of sockets that systemd was configured through
service units that process should have, systemd would have activated them
for us, we just then carry them over. We do sanity checks with the number
returned, so if we expected systemd to have set up 2 sockets for us we
should check for that number and then *additionally* systemd *does*
recommend that we validate the type of socket is what we expected and
hence the usage of sd_is_socket_unix(). The arguments for
sd_is_socket_unix() is what I set up in a struct mapped by the path.
This is what xs_claim_active_socket() ends up doing for us.

  Luis

  reply	other threads:[~2014-05-21 17:15 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-20 12:31 [PATCH v5 00/14] xen: add systemd support Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 01/14] xenstored: enable usage of config.h on both xenstored and oxenstored Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 02/14] libxenstore.so: add support for systemd Luis R. Rodriguez
2014-05-21 14:35   ` Ian Campbell
2014-05-21 14:56     ` Ian Campbell
2014-05-21 16:32       ` Luis R. Rodriguez
2014-05-21 16:48         ` Ian Campbell
2014-05-21 17:15           ` Luis R. Rodriguez [this message]
2014-05-22  9:36             ` Ian Campbell
2014-05-22  9:59               ` Luis R. Rodriguez
2014-05-21 16:24     ` Luis R. Rodriguez
2014-05-21 16:39       ` Ian Campbell
2014-05-21 17:29         ` Luis R. Rodriguez
2014-05-22  9:39           ` Ian Campbell
2014-05-22 10:01             ` Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 03/14] cxenstored: add support for systemd active sockets Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 04/14] oxenstored: " Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 05/14] oxenstored: force FD_CLOEXEC with Unix.set_close_on_exec on LSB init Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 06/14] tools/xendomains: make xl the default Luis R. Rodriguez
2014-05-21 15:05   ` Ian Campbell
2014-05-21 17:29     ` Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 07/14] tools/xendomains: do space cleanups Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 08/14] tools/xendomains: move to libexec and use a smaller init helper Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 09/14] autoconf: xen: force a refresh with autoconf Luis R. Rodriguez
2014-05-21 15:07   ` Ian Campbell
2014-05-21 17:35     ` Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 10/14] autoconf: update m4/pkg.m4 Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 11/14] autoconf: xen: move standard variables to a generic place Luis R. Rodriguez
2014-05-20 13:37   ` Jan Beulich
     [not found]   ` <537B76D1020000780001422C@suse.com>
2014-05-20 17:54     ` Luis R. Rodriguez
2014-05-21  7:32       ` Jan Beulich
2014-05-21  8:03         ` Luis R. Rodriguez
2014-05-21  8:11           ` Jan Beulich
2014-05-21  8:27             ` Luis R. Rodriguez
2014-05-21 10:33             ` Ian Campbell
2014-05-21 13:54               ` Jan Beulich
2014-05-21 15:14               ` Ian Campbell
2014-05-21 15:20                 ` Jan Beulich
2014-05-21 15:26   ` Ian Campbell
2014-05-21 21:54     ` Luis R. Rodriguez
2014-05-22  9:46       ` Ian Campbell
2014-05-20 12:31 ` [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference Luis R. Rodriguez
2014-05-21 15:44   ` Ian Campbell
2014-05-21 23:02     ` Luis R. Rodriguez
2014-05-22 10:05       ` Ian Campbell
2014-05-23 23:20         ` Luis R. Rodriguez
2014-05-28  9:30           ` Ian Campbell
2014-05-29 16:09             ` Don Koch
2014-05-29 23:29             ` Luis R. Rodriguez
     [not found]             ` <20140529232918.GG26450@wotan.suse.de>
2014-06-01  6:15               ` [systemd-devel] " Lennart Poettering
     [not found]               ` <20140601061547.GC16257@tango.0pointer.de>
2014-06-05  0:31                 ` Luis R. Rodriguez
     [not found]                 ` <20140605003103.GB22052@wotan.suse.de>
2014-06-05  2:52                   ` Cameron Norman
2014-06-05 11:22                   ` Lennart Poettering
     [not found]                   ` <20140605112213.GA17673@tango.0pointer.de>
2014-06-05 18:01                     ` Luis R. Rodriguez
     [not found]                     ` <20140605180137.GD22052@wotan.suse.de>
2014-06-05 19:24                       ` Lennart Poettering
     [not found]                       ` <20140605192421.GA6248@tango.0pointer.de>
2014-06-05 19:26                         ` Andrew Lutomirski
     [not found]                   ` <CALZWFR+LQ3XK4RQ335CNqjr8zucWw4GieKwZS3N5m0w4yJXuBA@mail.gmail.com>
2014-06-10  1:15                     ` Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 13/14] xencommons: move module list into a generic place Luis R. Rodriguez
2014-05-20 13:40   ` Jan Beulich
     [not found]   ` <537B776D020000780001425E@suse.com>
2014-05-20 18:03     ` Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 14/14] systemd: add xen systemd service and module files Luis R. Rodriguez
2014-05-20 12:48   ` Luis R. Rodriguez

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=20140521171521.GV13289@wotan.suse.de \
    --to=mcgrof@suse.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=mcgrof@do-not-panic.com \
    --cc=xen-devel@lists.xenproject.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).