[systemd-devel] systemd and templates

Lennart Poettering lennart at poettering.net
Fri Jul 13 08:34:01 PDT 2012


On Fri, 13.07.12 16:19, Michal Sekletar (msekleta at redhat.com) wrote:

> 
> On Tue, 2012-07-10 at 00:54 +0200, Lennart Poettering wrote:
> > Can you elaborate on this? Would generators work for you?
> > 
> > http://www.freedesktop.org/wiki/Software/systemd/Generators
> > 
> > (Sorry for not responding earlier!)
> > 
> > Lennart
> > 
> 
> Hi Lennart,
> 
> I'd like to work on this, because I think it makes sense and it will
> simplify administrators work-flow. I will try to make a proof of
> concept. Despite the fact that I have rough idea how to proceed I still
> have some doubts about the approach here. Maybe you (Kay, Michal) can
> provide opinion or suggestion how all this should work.
> 
> First thing from top of my head, is the placement of generated unit
> files. Question here is following: should we generate unit files once
> and store them to some more permanent location or proceed like in case
> of fstab or cryptsetup and store them in /run/systemd. So should we
> generate them on every boot or they should be generated only upon user
> request? I think it should be possible to run generator when requested
> by administrator.

I'd avoid the risk of having configuration that gets out of sync, and
hence generate them dynamically so that they are dropped and regenerated
when the source configuraiton changes. THis is what generators exist
for.

Note that with generators you don't necessarily have to generate full
units. Often itis sufficient to just create symlinks with those
generates that pull in certain other units. Or it might be sufficient to
simply instantiate template units as necessary. 

Note that the units generated by generators are bound to the systemd
life-cycle: they are removed when systemd daemon configuration is
reloaded, and regenerated in time. Hence, when the admin reloads systemd
configuration (via systemctl daemon-reload) then all generated units
will be correctly refreshed, too.

> My second concern is that, since these generators will be used to
> automatize work with large number of template instances, they will be
> similar, just like template units are similar to each other(from user
> point-of-view). Differences are hidden inside the template but usage is
> pretty much the same. So question here is, do we need only one universal
> generator capable to handle all template units in system (or selected
> subset) and generate instances if desired, or we need distinct generator
> for each template service? I'd say that solution with one universal
> generator is better.

I don't understand this, sorry. Can you elaborate, please?

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list