Gao feng
2013-Nov-14 05:41 UTC
Re: [libvirt-users] Problem about lxc-enter-namespace interface
On 11/14/2013 01:24 PM, Gao feng wrote:> On 11/14/2013 10:59 AM, hzguanqiang@corp.netease.com wrote: >> Hi experts, >> >> When I test lxc-enter-namespace interface, it turned out such an error: >> >> hzguanqiang@debian:~$ <mailto:hzguanqiang@debian:~$> vir version >> Compiled against library: libvirt 1.1.4 >> Using library: libvirt 1.1.4 >> Using API: LXC 1.1.4 >> Running hypervisor: LXC 3.9.6 >> >> hzguanqiang@debian:~$ <mailto:hzguanqiang@debian:~$> vir list >> Id Name State >> ---------------------------------------------------- >> 1544 instance-00000015 running >> >> hzguanqiang@debian:~$ <mailto:hzguanqiang@debian:~$> vir lxc-enter-namespace 1544 --noseclabel /bin/df -hl >> error: Cannot get namespaces for 1545: Function not implemented >> >> hzguanqiang@debian:~$ <mailto:hzguanqiang@debian:~$> ls /proc/self/ns >> ipc mnt net pid user uts >> >> What's the problem? >> > > Does your system have system call setns?grep setns /proc/kallsyms and grep setns the config.log of libvirt.
hzguanqiang@corp.netease.com
2013-Nov-14 05:52 UTC
Re: [libvirt-users] Problem about lxc-enter-namespace interface
On 2013-11-14 13:41 , Gao feng wrote: On 11/14/2013 01:24 PM, Gao feng wrote:> On 11/14/2013 10:59 AM, hzguanqiang@corp.netease.com wrote: >> Hi experts, >> >> When I test lxc-enter-namespace interface, it turned out such an error: >> >> hzguanqiang@debian:~$ <mailto:hzguanqiang@debian:~$> vir version >> Compiled against library: libvirt 1.1.4 >> Using library: libvirt 1.1.4 >> Using API: LXC 1.1.4 >> Running hypervisor: LXC 3.9.6 >> >> hzguanqiang@debian:~$ <mailto:hzguanqiang@debian:~$> vir list >> Id Name State >> ---------------------------------------------------- >> 1544 instance-00000015 running >> >> hzguanqiang@debian:~$ <mailto:hzguanqiang@debian:~$> vir lxc-enter-namespace 1544 --noseclabel /bin/df -hl >> error: Cannot get namespaces for 1545: Function not implemented >> >> hzguanqiang@debian:~$ <mailto:hzguanqiang@debian:~$> ls /proc/self/ns >> ipc mnt net pid user uts >> >> What's the problem? >> > > Does your system have system call setns?grep setns /proc/kallsyms and grep setns the config.log of libvirt. Hi, Gaofeng, thanks for your help. The info you want are: hzguanqiang@debian:~/github/libvirt$ sudo grep setns /var/log/libvirt/libvirtd.log hzguanqiang@debian:~/github/libvirt$ grep setns /proc/kallsyms ffffffff8105b993 T sys_setns What I found really strange is that the error info returned by the command. hzguanqiang@debian:~$ vir lxc-enter-namespace 1544 --noseclabel /bin/df -hl error: Cannot get namespaces for 1545: Function not implemented The instance id is 1544, but the error info hint cannot get ns for 1545. The libvirt code of mine is of version 1.1.4 from github (git checkout v1.1.4 -b stable1.1.4 ) ------------------ Best regards! GuanQiang 13:46:44
Gao feng
2013-Nov-14 06:17 UTC
Re: [libvirt-users] Problem about lxc-enter-namespace interface
On 11/14/2013 01:52 PM, hzguanqiang@corp.netease.com wrote:> On 2013-11-14 13:41 , Gao feng <mailto:gaofeng@cn.fujitsu.com> wrote: > > On 11/14/2013 01:24 PM, Gao feng wrote: > > On 11/14/2013 10:59 AM, hzguanqiang@corp.netease.com wrote: > >> Hi experts, > >> > >> When I test lxc-enter-namespace interface, it turned out such an error: > >> > >> hzguanqiang@debian:~$ <mailto:hzguanqiang@debian:~$> vir version > >> Compiled against library: libvirt 1.1.4 > >> Using library: libvirt 1.1.4 > >> Using API: LXC 1.1.4 > >> Running hypervisor: LXC 3.9.6 > >> > >> hzguanqiang@debian:~$ <mailto:hzguanqiang@debian:~$> vir list > >> Id Name State > >> ---------------------------------------------------- > >> 1544 instance-00000015 running > >> > >> hzguanqiang@debian:~$ <mailto:hzguanqiang@debian:~$> vir lxc-enter-namespace 1544 --noseclabel /bin/df -hl > >> error: Cannot get namespaces for 1545: Function not implemented > >> > >> hzguanqiang@debian:~$ <mailto:hzguanqiang@debian:~$> ls /proc/self/ns > >> ipc mnt net pid user uts > >> > >> What's the problem? > >> > > > > Does your system have system call setns? > > grep setns /proc/kallsyms > and > grep setns the config.log of libvirt. > > > Hi, Gaofeng, thanks for your help. The info you want are: >Hi,> hzguanqiang@debian:~/github/libvirt$ <mailto:hzguanqiang@debian:~/github/libvirt$> sudo grep setns /var/log/libvirt/libvirtd.logconfig.log not libvirtd.log, or you can exec "./configure | grep setns" under libvirt source directory.> hzguanqiang@debian:~/github/libvirt$ <mailto:hzguanqiang@debian:~/github/libvirt$> grep setns /proc/kallsyms > ffffffff8105b993 T sys_setns > > What I found really strange is that the error info returned by the command. > hzguanqiang@debian:~$ <mailto:hzguanqiang@debian:~$> vir lxc-enter-namespace 1544 --noseclabel /bin/df -hl > error: Cannot get namespaces for 1545: Function not implemented > The instance id is 1544, but the error info hint cannot get ns for 1545. >we have two libvirt lxc related process at the first start, one is controller process on host(pid 1544), the other is the container's init task(pid 1545). since lxc-enter-namespace wants to exec cmd in container environment. so libvirt will try to get the namespaces of container's init task. The problem is libvirt/autoconf thinks your system doesn't support setns system call...> The libvirt code of mine is of version 1.1.4 from github (git checkout v1.1.4 -b stable1.1.4 ) >I don't know if the libvirt git repo on github is the right thing, but As I know this repo git://libvirt.org/libvirt.git is official. Please have a try. Thanks