[lxc-users] [LXD] how to add cgroup options using lxc

Mark Constable markc at renta.net
Wed Mar 18 06:44:29 UTC 2015


On 18/03/15 16:04, KATOH Yasufumi wrote:
>> How do I translate the above settings for the lxc config command so
>> these same values end up in /var/lib/lxd/lxd.db?
>
> for example, (probably ^^;)

Bingo! Thank you :-)

> name: myprofile
> config:
>    raw.lxc: |-
>      lxc.cgroup.memory.soft_limit_in_bytes = 256M
> [...]

There is no way I would have figured out that "raw.lxc: |-" syntax to retain
line breaks in the SQLite insert entry without an example...

INSERT INTO "profiles_config" VALUES(3,2,'raw.lxc','lxc.cgroup.memory.soft_limit_in_bytes = 256M
lxc.cgroup.memory.limit_in_bytes = 512M
lxc.cgroup.memory.memsw.limit_in_bytes = 768M
lxc.cgroup.cpu.shares = 256
lxc.cgroup.blkio.weight = 500
lxc.cgroup.cpuset.cpus = 7');


~ lxc exec v1 -- bash
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
root at v1:~# free
              total       used       free     shared    buffers     cached
Mem:        524288       3548     520740    1187652          0        304
-/+ buffers/cache:       3244     521044
Swap:     15682556     361068   15321488

root at v1:~# grep processor /proc/cpuinfo
processor       : 0

Related question for anyone, will we ever get to see realistic Swap: values
in the future via the free command?



More information about the lxc-users mailing list