[libvirt-users] questions of libvirt's lxc

Han Yuejuan-B42073 B42073 at freescale.com
Wed Feb 27 07:51:23 UTC 2013


Hi all,

       I am trying  to init lxc by libvirt instead of using lxc tools. I have several questions as following:

       software platform: integrating libvirt-0.10.1 to yocto based on sdk1.3
       hardwatre platform: p4080ds

 steps:

root at p4080ds:~#  cat > container.xml <<EOF
<domain type='lxc'>
<name>container</name>
<memory>500000</memory>
<os>
<type>exe</type>
<init>/bin/sh</init>
</os>
<vcpu>1</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>
<interface type='network'>
<source network='default'/>
</interface>
<console type='pty' />
</devices>
</domain>
<EOF

root at p4080ds:~#  libvirtd -d

root at p4080ds:~# virsh --connect lxc:/// define container.xml
Domain container defined from container.xml

root at p4080ds:~# virsh --connect lxc:/// start container
error: Failed to start domain container
error: internal error Network 'default' is not active.

To resolve this issue I change the container.xml to as below:

<domain type='lxc'>
<name>container</name>
<memory>500000</memory>
<os>
<type>exe</type>
<init>/bin/sh</init>
</os>
<vcpu>1</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>
<interface type='bridge'>
<source network='br0'/>
<mac address='00:11:22:34:34:34'/> (I am not sure it will make difference)
</interface>
<console type='pty' />
</devices>
</domain>
then error infos as below:
root at p4080ds:~# virsh --connect lxc:/// define container.xml
error: Failed to define domain from container.xml
error: internal error No <source> 'bridge' attribute specified with <interface type='bridge'/>

Q1: What an appropriate virtual network is supported by virsh  for error mentioned above?
        Linux container support several types of network such as veth, vlan, macvlan, phys and how to edit different xml file for different network type?

Q2: There are two kinds of containers , application container and system container.
         If using lxc tools, lxc-execute will establish an application container and  lxc-create with lxc-start will establish a system container.
         So with libvirt how to set up these two kinds of containers? by different xml file or by different virsh cmds?

Q3: If I want to define a rootfs (such as busybox) for container how I edit the relative xml file? anyone has related infos that can be shared?

Q4:Cgroups manage and control  resources using for lxc containers. If use libvirt how to realise the similar resource tuning for containers  based on PowerPC?
       There are limited infos at: https://www.berrange.com/posts/2009/12/03/using-cgroups-with-libvirt-and-lxckvm-guests-in-fedora-12/

Regards,

Yuejuan





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20130227/705dccfc/attachment.htm>


More information about the libvirt-users mailing list