Wednesday, 16 November
2016
Wed, 16 Nov
'16
3:03 a.m.
People,
I've spent some time looking at the code and trying to understand what
are the needed changes in order to have this task done. I'll start by
writing down how things are working nowadays, what we want to achieve,
what are the parts that will need to be touched and what are the steps
that I'm going to take. Please, keep in mind that I may have a wrong
(or at least not so clear) understanding of all these points that I'm
about to explain and in case I made some mistake feel free to jump in
and correct me. Also, whatever we sum up from this email will be
written down in our DesignFeatures page. Let's start ...
How things work nowadays:
----------------------------------------
Nowadays all the services are started and taken care by the monitor.
It basically means that the monitor checks which are the services
listed to be started, starts those and registers them in order to
relay them signals coming from our tools. Here I'm not sure whether
the monitor relays signals from something else but the tools, but
doesn't seem to be case (and please, correct me in case I'm wrong).
What we want to achieve:
-------------------------------------
While my personal desire is to start slowly killing the monitor,
that's not going to be case right now.
We don't want to do any change in the code that wouldn't also
contemplate platforms where systemd is not available. That being said,
let's move to the important part ...
Here what we want to achieve is to have all responders (at least for
now, yes, just the responders) socket-activatable as some of them
don't actually have to be running all the time (that's the case, for
example, of the ssh, sudo and ifp responders). We also have to keep
into consideration that _any_ change in behaviour should _not_ happen,
which means that we still have to honor our compromise with sssd.conf
and still make the responders manually activated there to start and be
running from the moment sssd is running (as we do nowadays).
How we plan to achieve our goal:
-----------------------------------------------
Some parts I have a pretty clear idea on what to do, some others not
that much. The basic idea is to take as much advantage of systemd
machinery as we can and "remove" as much duties as possible from the
monitor. Let's go through this by parts ...
- Starting the service: the idea is to have a systemd unit for each of
the responders. Whether these units will be automatically generated by
us is a detail that doesn't worth attention right now. Let's take a
look on what the unit will look like:
[Unit]
Description=SSSD @responder@ service provider
[Install]
Also=sssd-@responder@.socket
[Service]
ExecStart==@libexecdir@/sssd/sssd_@responder@ --uid 0 --gid 0 --debug-to-files
Requires=sssd.service
PartOf=sssd.service
There's two options that deserve some explanation of their usage here:
-- "Requires=sssd.service": This option guarantees that sssd will be
up when any of the responders are up. Considering that the providers
part won't be changed, those will still be initializated synchronously
by the monitor and only then notify init that its start up finished,
which also mean that the providers' sbus socket will be up.
-- "PartOf=sssd.service": This options guarantees that when
sssd.service is restarted/stoped all the responders' services will be
restarted/stopped accordingly.
- Relaying signals: seems the best approach for this in order to
replace the registration currently done by the monitor, is to create a
named bus for each of the responders so the tools could talk directly
to them. By "named bus for each responder" I understand that's a pipe,
named sbus-@responder@ that will be used to send the dbus message
through it. It would require to adapt the tools code to actually check
whether the sbus-@responder@ pipe exists and then send the message, as
we won't have a list of the running responders, which may increase the
iterations to send a message but I do believe wouldn't hurt us too
much due to the small number of responders we have. It will also help
tools to be able to set different debug levels for each responder.
Seems, at least for me, that doing these steps we are covered with
respect to what we have nowadays. Does someone think that we are
missing something? What? Please, try to explain in the same way you
would explain to a 5 years old kid :-)
Coding plan:
------------------
My current plan is to start implementing this whole thing by creating
the named bus for each responder and have the communication between
the responders and the tools working. Next step will be to actually
have the responders started on demand by using socket-activation. And
the very last step will be to make sure we can have the responders
always running when they're listed in the sssd.conf.
I'm not comfortable on giving any estimation about when we will have
it done, mainly because I'd like to hear the feedback about this from
others in the team.
Looking forward for your reading back from you!
Best Regards,
--
Fabiano FidĂȘncio