[systemd-devel] [PATCH 1/1] Allow systemd to run without assigning container to machine.slice

Lennart Poettering lennart at poettering.net
Tue Feb 4 21:09:27 CET 2014

On Thu, 30.01.14 16:29, Daniel J Walsh (dwalsh at redhat.com) wrote:

> If I want to run a container as a service, it would be nice if it used the service
> cgroup configuration

I can see how this is useful, but I don't particularly like the nameing
of this, as this might suggest a new service was registered for this or
so, which is really not what happens (nor that would even be

So maybe instead have an option --scope=yes|no, where --scope=yes would
be the default, and the be identical to the status quo. (the argument
should be parsed with parse_boolean(), as usual).

Now, as Zbigniew pointed out this will break registration with machined,
which is highly useful for other stuff (like listing containers, and so
on). Before we merge this we need to figure out how we can make this
work while still registering things with machined. Maybe we can add
RegisterMachine() as new call to machined, in addition to the current
CreateMachine(), where the difference would be that RegisterMachine()
would simply register an externally created service or scope, while
CreateMachine() would always creat a new scope.

Such a change would be only one half of the solution though. To quickly
identify to which registered machine a service belongs, we'd need some
kind of lookup database in /run/systemd/machines/... Maybe a simple
symlink from the service name to the appropriate snippet would suffice?
libsystemd-logind calls like sd_pid_get_machine_name() would then try to
parse the machine name out of the scope name, as they currently do, but
if that doesn't work, would do one readlink() to resolve the unit. Does
that make sense?


Lennart Poettering, Red Hat

More information about the systemd-devel mailing list