<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi all,<br>
<br>
       I am trying  to init lxc by libvirt instead of using lxc tools. I have several questions as following:<br>
        <br>
       software platform: integrating <font size="2"><span style="font-size:10pt;">libvirt-<font size="2">0.10.1
<font size="2"><font size="2">to yoc<font size="2">to </font></font>based on sdk1.3<br>
<font size="2">       hardwatre platform: p4080ds<br>
<br>
<font size="2"> steps:<br>
</font></font></font></font></span></font><br>
<font size="2"><span style="font-size:10pt;"><font size="2"><font size="2"><font size="2"><font size="2"><font size="2"><span style="font-size:10pt;"><font size="2"><font size="2"><font size="2"><font size="2"><font size="2">root@p4080ds:~# 
</font></font></font></font></font></span></font>cat > container.xml <<EOF<font size="2"><br>
<font size="2"><</font>domain type='lxc'><br>
<name>container</name><br>
<memory>500000</memory><br>
<os><br>
<type>exe</type><br>
<init>/bin/sh</init><br>
</os><br>
<vcpu>1</vcpu><br>
<clock offset='utc'/><br>
<on_poweroff>destroy</on_poweroff><br>
<on_reboot>restart</on_reboot><br>
<on_crash>destroy</on_crash><br>
<devices><br>
<emulator>/usr/libexec/libvirt_lxc</emulator><br>
<interface type='network'><br>
<source network='default'/><br>
</interface><br>
<console type='pty' /><br>
</devices><br>
</domain><br>
<font size="2"><EOF</font><br>
</font></font></font></font></font></span></font><br>
root@p4080ds:~#  libvirtd -d <br>
 <br>
root@p4080ds:~# virsh --connect lxc:/// define container.xml<br>
Domain container defined from container.xml<br>
<br>
root@p4080ds:~# virsh --connect lxc:/// start container<br>
error: Failed to start domain container<br>
<font color="FF0000">error: internal error Network 'default' is not active.</font><br>
<br>
To resolve this issue I change the container.xml to as below:<br>
<br>
<font size="2"><span style="font-size:10pt;"><font size="2"><font size="2"><font size="2"><font size="2"><font size="2"><font size="2"><</font>domain type='lxc'><br>
<name>container</name><br>
<memory>500000</memory><br>
<os><br>
<type>exe</type><br>
<init>/bin/sh</init><br>
</os><br>
<vcpu>1</vcpu><br>
<clock offset='utc'/><br>
<on_poweroff>destroy</on_poweroff><br>
<on_reboot>restart</on_reboot><br>
<on_crash>destroy</on_crash><br>
<devices><br>
<emulator>/usr/libexec/libvirt_lxc</emulator><br>
<interface type='<font size="2">bridge</font>'><br>
<source network='<font size="2">br<font size="2">0</font></font>'/><br>
</font></font></font></font></font></span></font><mac address='00:11:22:34:34:34'/> (I am not sure it will make difference)<br>
</interface><br>
<console type='pty' /><br>
</devices><font size="2"><span style="font-size:10pt;"><font size="2"><font size="2"><font size="2"><font size="2"><font size="2"><br>
</domain></font></font></font></font></font></span></font><br>
then error infos as below:<br>
<font color="FF0000">root@p4080ds:~# virsh --connect lxc:/// define container.xml<br>
error: Failed to define domain from container.xml<br>
error: internal error No <source> 'bridge' attribute specified with <interface type='bridge'/></font><br>
<br>
Q1: What an appropriate virtual network is supported by virsh  for error mentioned above? 
<br>
        Linux container support several types of network such as veth, vlan, macvlan, phys and how to edit different xml file for different network type?<br>
<br>
Q2: There are two kinds of containers , application container and system container.<br>
         If using lxc tools, lxc-execute will establish an application container and  lxc-create with lxc-start will establish a system container.<br>
         So with libvirt how to set up these two kinds of containers? by different xml file or by different virsh cmds?<br>
<br>
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?<br>
<br>
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?<br>
       There are limited infos at: <a href="https://www.berrange.com/posts/2009/12/03/using-cgroups-with-libvirt-and-lxckvm-guests-in-fedora-12/" target="_blank">
https://www.berrange.com/posts/2009/12/03/using-cgroups-with-libvirt-and-lxckvm-guests-in-fedora-12/</a><br>
<br>
Regards,<br>
<br>
Yuejuan<br>
<br>
<br>
<br>
<pre><br></pre>
<pre><br></pre>
<font size="2"><span style="font-size:10pt;"><font size="2"><font size="2"></font></font></span></font></div>
</body>
</html>