[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt-users] lxc and cgroups



Dear list,

I am bulding a VM using libvirt and lxc for linux container. I have an
issue with my cgroups settings:

gabx hortensia ➤➤ ~ # virsh start dahlia
error: Failed to start domain dahlia
error: internal error: No valid cgroup for machine dahlia


My environement:

Host : Arch Linux - systemd 208-11, libvirt 1.2.1-4
guest : Arch Linux , machine name : dahlia ,
/etc/libvirt/lxc/dahlia.xml , mounted in /machine/dahlia

My set up so far :

- gabx hortensia ➤➤ ~ % sudo virsh uri
[sudo] password for root:
lxc:///

- gabx hortensia ➤➤ ~ # virsh -c lxc:/// list --all
 Id    Name                           State
----------------------------------------------------
 -     dahlia                         shut off

- custom kernel with user space set
gabx hortensia ➤➤ ~ % zgrep USER_NS /proc/config.gz
CONFIG_USER_NS=y

- /etc/libvirt/lxc/dahlia.xml
$ ls -al
-rw------- 1 root root 1.1K Feb 15 12:11 /etc/libvirt/lxc/dahlia.xml

$ cat
<domain type='lxc'>
  <name>dahlia</name>
  <uuid>a34b58db-894f-4f4a-81f0-b13d2d5d7732</uuid>
  <memory unit='KiB'>409600</memory>
  <currentMemory unit='KiB'>409600</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <resource>
    <partition>/machine/dahlia</partition>
  </resource>
  <os>
    <type arch='x86_64'>exe</type>
    <init>/bin/init</init>
  </os>
  <idmap>
    <uid start='0' target='1000' count='10'/>
    <gid start='0' target='1000' count='10'/>
  </idmap>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/lib/libvirt/libvirt_lxc</emulator>
    <interface type='network'>
      <mac address='52:54:00:89:8f:1a'/>
      <source network='default'/>
    </interface>
    <console type='pty'>
      <target type='lxc' port='0'/>
    </console>
  </devices>
</domain>

- fstab :
UUID=f69d032f-c80f-4f2e-84cd-d2328a862818    /machine/dahlia    ext4
     defaults,relatime,discard             0         1
$ ls -al
drwxr-xr-x 17 root root 4.0K Feb 11 21:41 dahlia/

- /etc/cgconfig:

group dahlia {

    perm {
# who can manage limits
        admin {
            uid = 1000;
            gid = 1004;
            }
# who can add task
        task {
            uid = 1000;
            gid = 1004;
            }
        }

# create this group in the controllers
    cpu { }
    cpuset { }
    memory { }
    devices { }
    freezer { }
    net_cls { }
    blkio { }
}

- /etc/cgrules is deafult one, so everything is commented. Maybe shall
I edit a line ??

- gabx hortensia ➤➤ ~ # cat /proc/cgroups
#subsys_name    hierarchy    num_cgroups    enabled
cpuset    3    5    1
cpu    4    4    1
cpuacct    4    4    1
memory    5    5    1
devices    6    4    1
freezer    7    5    1
net_cls    8    5    1
blkio    9    4    1

Something puzzles me. In /sys/fs/cgroup/blkio,  I see two dirs: dahlia
and machine.slice. Inside machine.slice, I see another dir
machine-dahlia. I guess there is something wrong here !! Same for
cpuset or other controllers.

- gabx hortensia ➤➤ ~ % systemctl status machine-dahlia.slice
machine-dahlia.slice - dahlia VM slice
   Loaded: loaded (/etc/systemd/system/machine-dahlia.slice; static)
   Active: active since Sat 2014-02-15 11:53:01 CET; 15min ago

Feb 15 11:53:01 hortensia systemd[1]: Starting dahlia VM slice.
Feb 15 11:53:01 hortensia systemd[1]: Created slice dahlia VM slice.

My systemd unit file machine-dahlia.slice in /etc/systemd/system

Apologize for the long post, but I wanted to detail everything.

Thank you for help on my cgroup set up.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]