On Mon, Jun 10, 2013 at 09:29:32AM +0400, свящ. Георгий Гольцов wrote:
On Mon, Jun 10, 2013 at 09:07:08AM +0800, Gao feng wrote:
> On 06/09/2013 08:14 PM, pr.G wrote:
> > Hello.
> >
> > Is it possible to start container via libvirt_lxc without mounting /sys
> > inside container?
> >
> > When I start container via lxc-start and do not add mount point to config,
> > then /sys inside container is empty.
> >
> > When I do it via virsh -c lxc:// container.xml, then
> > /sys contains sysfs of the host and /sys on host becomes remounting read-only.
>
> how can it be true? Can you post your /proc/mounts on host and container?
>
> >
> > Am I doing something wrong or is this feature of libvirt_lxc?
> >
>
> Absolutely it's not a feature.
>
> Thanks!
>
Thanks for the quick reply.
I was surprised too. I didn't post /proc/mounts to container.
libvirt_lxc did it for me.
I read
http://libvirt.org/drvlxc.html about Filesystem mounts:
"
In the absence of any explicit configuration, the container will
inherit the host OS filesystem mounts. A number of mount points will be
made read only, or re-mounted with new instances to provide container
specific data. The following special mounts are setup by libvirt
* /dev a new "tmpfs" pre-populated with authorized device nodes
* /dev/pts a new private "devpts" instance for console devices
* /sys the host "sysfs" instance remounted read-only
* /proc a new instance of the "proc" filesystem
* /proc/sys the host "/proc/sys" bind-mounted read-only
* /sys/fs/selinux the host "selinux" instance remounted read-only
* /sys/fs/cgroup/NNNN the host cgroups controllers bind-mounted to
* only expose the sub-tree associated with the container
* /proc/meminfo a FUSE backed file reflecting memory limits of the
* container
"
Can I disable this behavior?
How do I specify an explicit configuration?
Thanks.
my container.xml: (The entire xml file is shown in the my original post)
...
<devices>
<emulator>/usr/lib/libvirt/libvirt_lxc</emulator>
<filesystem type='mount'>
<source dir='/var/lxc/ns1/rootfs'/>
<target dir='/'/>
</filesystem>
...
</device>
...
> > Thanks.
> >
> > root@host:~# uname -a
> > Linux host 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2+deb7u2 x86_64 GNU/Linux
> >
> > root@host:~# cat /etc/os-release
> > PRETTY_NAME="Debian GNU/Linux 7.0 (wheezy)"
> > ...
> >
> > root@host:~# dpkg -l | grep libvirt
> > ii libvirt-bin 0.9.12-11 amd64 programs for the libvirt library
> > ii libvirt0 0.9.12-11 amd64 library for interfacing with different
virtualization systems
> >
> >
> > container.xml:
> > <domain type='lxc'>
> > <name>ns1</name>
> > <memory>524288</memory>
> > <os>
> > <type>exe</type>
> > <init>/sbin/init</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/lib/libvirt/libvirt_lxc</emulator>
> > <filesystem type='mount'>
> > <source dir='/var/lxc/ns1/rootfs'/>
> > <target dir='/'/>
> > </filesystem>
> > <interface type='bridge'>
> > <source bridge='br0'/>
> > <mac address='52:54:00:de:74:06'/>
> > </interface>
> > <console type='pty' />
> > </devices>
> > </domain>
> >
> >
> > _______________________________________________
> > libvirt-users mailing list
> > libvirt-users(a)redhat.com
> >
https://www.redhat.com/mailman/listinfo/libvirt-users
> >
>