[lxc-users] Is it possible to change lxc.cgroup.memory.limit_in_bytes in runtime? [LXD]

Ivan Kurnosov zerkms at zerkms.ru
Mon Jul 3 09:10:11 UTC 2017


Thanks,

yep, that's what I ended up doing - I just write directly to the cgroup
files (together with modifying raw.lxc). I would have posted it earlier,
but did not know how to reply to my own email which I did not receive :-S

Thanks again.

On 3 July 2017 at 21:06, Fajar A. Nugraha <list at fajar.net> wrote:

> On Mon, Jul 3, 2017 at 7:05 AM, Ivan Kurnosov <zerkms at zerkms.ru> wrote:
>
>> Hi,
>>
>> I've went through the lxd and go-lxc binding to find the answer myself
>> but I stuck at
>>
>> bool go_lxc_set_config_item(struct lxc_container *c, const char *key,
>> const char *value) {
>> return c->set_config_item(c, key, value);
>> }
>>
>> Internally - that's how the config parameters are changed.
>>
>> But is it possible to change lxc config parameters
>> like lxc.cgroup.memory.memsw.limit_in_bytes
>> or lxc.cgroup.memory.limit_in_bytes in runtime using some of lxc or lxd
>> cli utils, so that it was not required to restart a container to get its
>> new memory limits.
>>
>>
> In lxc, the only way I know how is to modify cgroup files directly. e.g.
> /sys/fs/cgroup/memory/lxc/your_container_name/memory.limit_in_bytes .
> That would modify current effective value, while editing lxc config file
> would ensure the new config stays the same after container stop-start.
>
> In lxd, for some limits (e.g. limits.memory, the equivalent
> of lxc.cgroup.memory.memsw.limit_in_bytes), "lxc config edit
> your_container_name" should modify both effective and configured limits
> interactively. You can also perform the change non-interactively, see "lxc
> config help" for details. I don't think memory.memsw.limit_in_bytes has an
> lxd equivalent though.
>
> --
> Fajar
>
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
>



-- 
With best regards, Ivan Kurnosov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20170703/4d7f0acb/attachment.html>


More information about the lxc-users mailing list