Hello, we encounter a problem in the use of lxc, that the command of free and
top does
not show container\'s cpu and memory but the host server\'s;we know that it is
a problem
of proc directory which is mounted outside the container with remount option.we
also
know that we can solve this problem with fuse.
now we put forward another solution which is also based on fuse,but with more
difference,our solution is modify lxc-start.c:
before do_clone() we use fuse to generate a userspaces proc filesystem,call
mount() to
mount /lxc/as6.3/proc directory;
after perform mount_rootfs_dir ($rootfs, $target) ,then call mount() to mount
/lxc/as6.3/proc/{stat, meminfo, sysrq-trigger} to target/{stat, meminfo,
sysrq-trigger} with --
bind option.
When a virtual machine to read /proc/meminfo, it will read the meminfo of from
userspaces filesystem, we can get the correct value is returned to the virtual
machine
from /cgroup/memory.if read /proc/stat, we can get value form /cgroup/cpuacct.
All mount implemented in lxc_start.c using c language, userspace files can be
configured in the configuration file and dynamic loading.
The function of open and read and write of meminfo,stat,sysrq-trigger must be
implemented by us.
this is a example,in configuration file:
lxc.cgroup.memory.limit_in_bytes = 268435456
lxc.cgroup.memory.memsw.limit_in_bytes = 536870912
[shell]#free -m
total used free shared buffers cached
Mem: 256 13 242 0 0 0
-/+ buffers/cache: 13 242
Swap: 512 13 498
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel