Skip to content

Configuration

Niklas Eiling edited this page May 26, 2016 · 1 revision

XML Reference

General Setting

Container name

<name>f22-1</name>

has to match an existing container's name

Including LXC Config files

Different Distributions require a different LXC configuration. The distribution specific configuration is done in the config files included here.

<metadata>   
    <lxctools:include>/usr/local/share/lxc/config/fedora.common.conf</lxctools:include>
</metadata>

Limit Memory Usage

Set hard memory limit

<maxMemory slots='1' unit='KiB'>2049244</maxMemory>
<currentMemory unit='KiB'>2049200</currentMemory>

note: Memory Balloning ist not neccessary with containers, thus maxMemory and currentMemory have to always have the same value.

Set soft memoroy limit

<memtune>
   <soft_limit unit='KiB'>1048576</soft_limit>
</memtune>

(implemented using cgroups soft_limit_in_bytes. see RedHat Documentation )

Pin to NUMA Nodes

<numatune>
    <memory mode='strict' nodeset='0'/>
</numatune>

CPU Setting

Pin to CPUs

<vcpu placement='static' cpuset='0-3'>4</vcpu>

the vcpupin option is not available.

Limit CPU Usage

<cputune>
   <shares>100</shares>
   <period>1000000</period>
   <quota>200000</quota>
</cputune>

See RedHat Cgroup Documentation for more details.

Architecture

<os>
  <type arch='x86_64'>exe</type>
</os>

Only x86_64 and i686 are supported

Network Settings

Only the bridge network type is currently supported. This maps to the veth network type in LXC. The source bridge options sets the name of the bridge that is used.

<interface type='bridge'>
    <mac address='00:26:3e:f6:ab:b0'/>
    <source bridge='virbr0'/>
    <link state='up'/>
</interface>

File System Settings

Set Rootfs

Exactly one file system entry has to have '/' as target directory. Paths in source are relative to the host's root and paths in target are relative the guest's root.

<filesystem type='mount' accessmode='passthrough'>
    <driver type='path'/>
    <source dir='/usr/local/var/lib/lxc/<cont-name>/rootfs'/>
    <target dir='/'/>
</filesystem>

Add Bind-Mounts

As above, only with any target directory.

<filesystem type='mount' accessmode='passthrough'>
    <driver type='path'/>
    <source dir='/home/user'/>
    <target dir='/home/user'/>
</filesystem>

Currently, the only supported driver type is path and the only supported accessmode is passthrough. This translates to a simple bind mount.

see Libvirt Documentation for more details on the libvirt XML format.

Clone this wiki locally