[libvirt] LXC support?

Cole Robinson crobinso at redhat.com
Wed Dec 23 19:28:15 UTC 2009


On 12/23/2009 01:12 PM, Diego Elio “Flameeyes” Pettenò wrote:
> I've been wanting to give a try to libvirt to handle containers from LXC
> as well, but seems like if I follow the default configuration example, I
> get this:
> 
> virsh # create /etc/libvirt/lxc/axant.xml 
> errore: Impossibile creare il dominio da /etc/libvirt/lxc/axant.xml
> errore: unknown OS type exe
> 
> [sorry for the Italian message, but it doesn't really matter]
> 
> The configuration is this:
> 
> <domain type='lxc'>
>   <name>axant</name>
>   <memory>14680064</memory>
>   <os>
>     <type>exe</type>
>     <init>/init</init>
>   </os>
>   <vcpu>8</vcpu>
>   <clock offset="utc" />
>   <on_poweroff>destroy</on_poweroff>
>   <on_reboot>restart</on_reboot>
>   <on_crash>destroy</on_crash>
>   <devices>
>     <emulator>/usr/libexec/libvirt_lxc</emulator>
> 
>     <filesystem type='mount'>
>       <source dir='/media/chroots/axant'/>
>       <target dir='/'/>
>     </filesystem>
> 
>     <interface type='bridge'>
>       <mac address="8e:8b:e5:aa:28:b6" />
>       <source bridge="br0" />
>     </interface>
>     <console type='pty' />
>   </devices>
> </domain>
> 
> am I doing something wrong or the doc at [1] is outdated somehow?
> 
> 
> [1] http://libvirt.org/drvlxc.html
> 

What is the output of 'virsh --connect lxc:/// capabilities'? Mine looks like:

<capabilities>

  <host>
    <cpu>
      <arch>x86_64</arch>
    </cpu>
    <topology>
      <cells num='1'>
        <cell id='0'>
          <cpus num='2'>
            <cpu id='0'/>
            <cpu id='1'/>
          </cpus>
        </cell>
      </cells>
    </topology>
  </host>

  <guest>
    <os_type>exe</os_type>
    <arch name='x86_64'>
      <wordsize>32</wordsize>
      <emulator>/usr/libexec/libvirt_lxc</emulator>
      <domain type='lxc'>
      </domain>
    </arch>
  </guest>

</capabilities>


And I can define your posted config without error. If you don't have a guest
block, defining any guest will fail, so the lxc capability detection probably
needs to be taught how to work with your system. You can checkout out
src/lxc/lxc_conf.c:lxcCapsInit

- Cole




More information about the libvir-list mailing list