[systemd-devel] Setting Environment Configuration (Affinity) for Slices
Chris Bell
cwbell at narmos.org
Mon Oct 19 08:58:44 PDT 2015
Hi all,
Is there a way to set an affinity for an entire slice? Say, for example,
I have system-webhosted.slice, but I only want the services running
within system-webhosted.slice to run on cores 5-8. I can set this
individually per service (systemd.exec man page), but it does not
indicate that I can do this for slices. Also, the systemd.slice man page
says it only accepts resource control directives, not environment config
directives. Is there any way I can set an environment config directive
for an entire slice? Or do I need to do it per-service?
Alternatively, is there a way (and this sounds way too hacky) to
hierarchically order a slice under a service? So, basically I can start
some dummy service with environment configs, and the slice will be a
child of that service and all units in that slice will inherit the
environment configs from the parent of the slice?
/
└─system.slice
└─dummy-slice-wrapper.service
└─system-webhosted.slice
├─httpd.service
└─postgresql.service
Where dummy-slice-wrapper.service has affinity set to 5-8 and has
system-webhosted.slice as a child. Then the services inside the slice
(httpd, postgre) also have their affinity locked to 5-8, without having
to specify it with an override for each service.
I've noticed that systemd-nspawn@<machine>.servce has a child
'system.slice' though I don't know if that setup can enforce what I'd
like it to.
Is there any way to do this with the current setup?
Thanks in advance!!
--Chris
More information about the systemd-devel
mailing list