Re: [systemd-devel] Adding controllers

2017-03-02 Thread Lennart Poettering
On Thu, 02.03.17 15:28, Bhasker C V (bhas...@unixindia.com) wrote:
> [Manager]
> JoinControllers=

JoinControllers= is not what you think it is. It's a system-wide
setting for mount multiple cgroupsv1 controllers into the same
hierarchy. You almost never need that in real-life.

> 
> ---
> 
> From what I can read from the man page, The joincontrollers is a list
> of controllers the systemd unit will "not" join.. Please correct me if
> my understanding is wrong.
> I am however not able to make this systemd-nspawn join freezer controller.
> 
> The only way I am able to achieve this is
> 
> 
> ExecStart=/usr/bin/cgexec -g freezer:/ubuntu /usr/bin/systemd-nspawn
> --keep-unit -jbD /machines/ubuntu
> 
> (of course I use ExecStartPre to create the freezer:/ubuntu)
> 
> 
> But I feel there must be more systemd-native elegant way to do this.
> Please can someone guide me ?

systemd does not support the freezer controller, as it's interface to
userspace is simply broken.

Delegation of controllers to less privileges containers is not safe,
and we don't support that right now either. Sorry.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Adding controllers

2017-03-02 Thread Bhasker C V
Hi,

 I tried to look for information but could not get any.
 I have created a systemd unit which runs systemd-nspawn of my local
ubuntu rootfs.
 The unit has values to restrict cpu, memory etc.,


[Unit]
Description=ubuntu
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/systemd-nspawn --keep-unit -jbD /machines/ubuntu
CPUAcounting=yes
MemoryAccouting=yes
CPUShares=200
MemorySwapMax=1M
MemoryMax=1073741824
MemoryLimit=1073741824
CPUQuota=50%
TasksMax=100

[Install]
WantedBy=multi-user.target


[Manager]
JoinControllers=

---

From what I can read from the man page, The joincontrollers is a list
of controllers the systemd unit will "not" join.. Please correct me if
my understanding is wrong.
I am however not able to make this systemd-nspawn join freezer controller.

The only way I am able to achieve this is


ExecStart=/usr/bin/cgexec -g freezer:/ubuntu /usr/bin/systemd-nspawn
--keep-unit -jbD /machines/ubuntu

(of course I use ExecStartPre to create the freezer:/ubuntu)


But I feel there must be more systemd-native elegant way to do this.
Please can someone guide me ?

thanks
Bhasker
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel