hi all,
I try to follow the instructions in
http://libvirt.org/drvlxc.html to config
libvirt-lxc, but failed when starting the lxc.
The domain config file:
# cat b.xml
<domain type='lxc'>
<name>b</name>
<memory>32768</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>
<filesystem type='mount'>
<source dir='/data/lxc/centos6'/>
<target dir='/'/>
</filesystem>
<interface type='network'>
<source network='default'/>
</interface>
<console type='pty' />
</devices>
</domain>
then define it:
# virsh --connect lxc:/// define b.xml
Domain b defined from b.xml
then start:
# virsh --connect lxc:/// start b
error: Failed to start domain b
error: internal error guest failed to start: 2012-10-10 09:56:17.369+0000: 452722: info :
libvirt version: 0.9.10, package: 21.el6_3.4 (CentOS BuildSystem
<
http://bugs.centos.org>, 2012-08-23-18:28:26,
c6b9.bsys.dev.centos.org)
2012-10-10 09:56:17.369+0000: 452722: error : lxcControllerRun:1484 : Failed to query file
context on /data/lxc/centos6: No data available
It's the filesystem mount section that cause this problem. The tutorial says the path
'/data/lxc/centos6' should be "private root filesystem (perhaps hand-crafted
using busybox, or installed from media, debootstrap, whatever)", but I am not quite
clear about what this path should be. In my case, the "/data/lxc/centos6" is the
root of template downloaded from
http://wiki.openvz.org/Download/template/precreated.
# pwd
/data/lxc/centos6
# ls
bin boot dev etc fastboot home lib media mnt opt proc root sbin selinux srv
sys tmp usr var
Can someone elaborate what should <source dir='/data/lxc/centos6'/> be?
many thanks