[lxc-users] Attach a lxc container to an existing cgroup ?

Jäkel, Guido G.Jaekel at dnb.de
Fri Mar 21 07:19:03 UTC 2014


Dear Sebastian,

as to my knowledge, with the current version of LXC you might use more than one configuration file and in addition, there's a file include option in the configuration parser. And even with an older, you may simulate this by a little wrapper that convert a config file into a bunch of "-s" options.

Said that, I'm using a hierarchical LXC configuration since years that will stick together global, group and individual aspects of a container.

You might be able to approximate your aims in another way, if you consider to include a "customer X" policy into the different configuration for the containers for customer X. Of course, you just can archive similar settings for a group and can't directly control the sum of an aspect (e.g. memory), but I wonder if this real constructive. 

And you can't change something for the involved containers at once by touching one value at one cgroup entry. But you may write a little script that will re-read the lxc configuration and update the definded cgroup entries. @Serge: Such an lxc-reconfigure command may be something to add to the lxc package.

Greetings

Guido


>-----Original Message-----
>From: lxc-users-bounces at lists.linuxcontainers.org [mailto:lxc-users-bounces at lists.linuxcontainers.org] On Behalf Of
>Sébastien Kurtzemann
>Sent: Friday, March 21, 2014 12:37 AM
>To: LXC users mailing-list
>Subject: Re: [lxc-users] Attach a lxc container to an existing cgroup ?
>
>lxc.cgroup.pattern is a global directive, no ?
>
>I can't define it per container ?
>so it's not possible to set "custo1.dev" container into /custo1 cgroup
>and "custo2.dev" into another /custo2 cgroup
>
>
>2014-03-20 0:42 GMT+01:00 Serge Hallyn <serge.hallyn at ubuntu.com>:
>> Quoting Sébastien Kurtzemann (fai.ml at kurtzemann.fr):
>>> Hi all,
>>>
>>> My idea is to create a "parent" cgroup which defined customer's
>>> ressources like cpu, mem, ...
>>> For example I've a cgroup called "customer1" on the subsystem "cpuset"
>>> on which I pin the first cpu (cpuset.cpus = 1)
>>>
>>> In this "parent" cgroup I wanted 3 containers which represent customer
>>> environments (dev, preprod, prod)
>>> Each environements has specific ressources (dev 20% cpu, preprod 20%, prod 60%)
>>>
>>> Can we attach these new containers to the existing "parent" cgroup ?
>>
>> You can set
>>
>>         lxc.cgroup.pattern = /customer/dev/%n
>>
>> which will put the container into /customer/dev/$name
>>
>> -serge
>> _______________________________________________
>> lxc-users mailing list
>> lxc-users at lists.linuxcontainers.org
>> http://lists.linuxcontainers.org/listinfo/lxc-users
>_______________________________________________
>lxc-users mailing list
>lxc-users at lists.linuxcontainers.org
>http://lists.linuxcontainers.org/listinfo/lxc-users


More information about the lxc-users mailing list