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

KATOH Yasufumi karma at jazz.email.ne.jp
Wed Mar 18 06:04:47 UTC 2015


>>> On Wed, 18 Mar 2015 14:03:07 +1000
    in message   "[lxc-users] [LXD] how to add cgroup options using lxc"
                  Mark Constable-san wrote:

> Ubuntu vivid w/ lxd-daily.

> When setting up unprivileged containers via lxc-create these cgroup
> settings come from ~/.config/lxc/default.conf and for the most part
> seem to work.
>  lxc.cgroup.memory.soft_limit_in_bytes = 256M
> lxc.cgroup.memory.limit_in_bytes = 512M
> lxc.cgroup.memory.memsw.limit_in_bytes = 256M
> lxc.cgroup.cpu.shares = 256
> lxc.cgroup.blkio.weight = 500
> lxc.cgroup.cpuset.cpus = 7

> 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 ^^;)

  lxc config profile copy default myprofile
  lxc config profile edit myprofile
  (start editor, edit profile)

----
name: myprofile
config:
  raw.lxc: |-
    lxc.cgroup.memory.soft_limit_in_bytes = 256M
    lxc.cgroup.memory.limit_in_bytes = 512M
    lxc.cgroup.memory.memsw.limit_in_bytes = 256M
    lxc.cgroup.cpu.shares = 256
    lxc.cgroup.blkio.weight = 500
    lxc.cgroup.cpuset.cpus = 7
devices:
  eth0:
    nictype: bridged
    parent: lxcbr0
    type: nic
---

  lxc config profile apply mycontainer myprofile
  lxc config profile show mycontainer
  Profiles: myprofile

--
KATOH Yasufumi


More information about the lxc-users mailing list