<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<STYLE>
BLOCKQUOTE {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; MARGIN-LEFT: 2em
}
OL {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
UL {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
P {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
BODY {
LINE-HEIGHT: 1.5; FONT-FAMILY: 微软雅黑; COLOR: #000000; FONT-SIZE: 10.5pt; 36719: ; 38597: ; 40657:
}
</STYLE>
<META name=GENERATOR content="MSHTML 8.00.7601.17514"></HEAD>
<BODY style="MARGIN: 10px; FONT-FAMILY: verdana; FONT-SIZE: 10pt">
<DIV>On 2013-11-14 16:40 , <A href="mailto:gaofeng@cn.fujitsu.com">Gao
feng</A> wrote:</DIV>
<DIV>
<TABLE width="100%">
<TBODY>
<TR>
<TD width="100%">
<BLOCKQUOTE
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
<DIV>On 11/14/2013 03:09 PM, hzguanqiang@corp.netease.com wrote:</DIV>
<DIV>> On 2013-11-14 15:03 , Gao feng
<mailto:gaofeng@cn.fujitsu.com> wrote:</DIV>
<DIV>> </DIV>
<DIV>> On 11/14/2013 02:57 PM,
hzguanqiang@corp.netease.com wrote:</DIV>
<DIV>> > On 2013-11-14 14:17 , Gao feng
<mailto:gaofeng@cn.fujitsu.com> wrote:</DIV>
<DIV>> ></DIV>
<DIV>> > On
11/14/2013 01:52 PM, hzguanqiang@corp.netease.com wrote:</DIV>
<DIV>> > > On
2013-11-14 13:41 , Gao feng <mailto:gaofeng@cn.fujitsu.com>
wrote:</DIV>
<DIV>> >
></DIV>
<DIV>> >
> On 11/14/2013 01:24 PM, Gao feng
wrote:</DIV>
<DIV>> >
> > On 11/14/2013 10:59 AM,
hzguanqiang@corp.netease.com wrote:</DIV>
<DIV>> >
> >> Hi experts,</DIV>
<DIV>> >
> >></DIV>
<DIV>> >
> >> When I test lxc-enter-namespace
interface, it turned out such an error:</DIV>
<DIV>> >
> >></DIV>
<DIV>> >
> >> hzguanqiang@debian:~$
<mailto:hzguanqiang@debian:~$> vir version</DIV>
<DIV>> >
> >> Compiled against library: libvirt
1.1.4</DIV>
<DIV>> >
> >> Using library: libvirt 1.1.4</DIV>
<DIV>> >
> >> Using API: LXC 1.1.4</DIV>
<DIV>> >
> >> Running hypervisor: LXC
3.9.6</DIV>
<DIV>> >
> >></DIV>
<DIV>> >
> >> hzguanqiang@debian:~$
<mailto:hzguanqiang@debian:~$> vir list</DIV>
<DIV>> >
> >> Id
Name
State</DIV>
<DIV>> >
> >>
----------------------------------------------------</DIV>
<DIV>> >
> >> 1544
instance-00000015
running</DIV>
<DIV>> >
> >></DIV>
<DIV>> >
> >> hzguanqiang@debian:~$
<mailto:hzguanqiang@debian:~$> vir lxc-enter-namespace 1544
--noseclabel /bin/df -hl</DIV>
<DIV>> >
> >> error: Cannot get namespaces for
1545: Function not implemented</DIV>
<DIV>> >
> >></DIV>
<DIV>> >
> >> hzguanqiang@debian:~$
<mailto:hzguanqiang@debian:~$> ls /proc/self/ns</DIV>
<DIV>> >
> >> ipc mnt net
pid user uts</DIV>
<DIV>> >
> >></DIV>
<DIV>> >
> >> What's the problem?</DIV>
<DIV>> >
> >></DIV>
<DIV>> >
> ></DIV>
<DIV>> >
> > Does your system have system call
setns?</DIV>
<DIV>> >
> </DIV>
<DIV>> >
> grep setns /proc/kallsyms</DIV>
<DIV>> >
> and</DIV>
<DIV>> >
> grep setns the config.log of libvirt.</DIV>
<DIV>> >
> </DIV>
<DIV>> >
></DIV>
<DIV>> > > Hi,
Gaofeng, thanks for your help. The info you want are:</DIV>
<DIV>> >
></DIV>
<DIV>> > </DIV>
<DIV>> > Hi,</DIV>
<DIV>> > </DIV>
<DIV>> > >
hzguanqiang@debian:~/github/libvirt$
<mailto:hzguanqiang@debian:~/github/libvirt$> sudo grep setns
/var/log/libvirt/libvirtd.log</DIV>
<DIV>> > </DIV>
<DIV>> >
config.log not libvirtd.log, or you can exec "./configure | grep setns"
under libvirt source directory.</DIV>
<DIV>> > </DIV>
<DIV>> > >
hzguanqiang@debian:~/github/libvirt$
<mailto:hzguanqiang@debian:~/github/libvirt$> grep setns
/proc/kallsyms</DIV>
<DIV>> > >
ffffffff8105b993 T sys_setns</DIV>
<DIV>> >
></DIV>
<DIV>> > > What
I found really strange is that the error info returned by the
command.</DIV>
<DIV>> >
> hzguanqiang@debian:~$
<mailto:hzguanqiang@debian:~$> vir lxc-enter-namespace 1544
--noseclabel /bin/df -hl</DIV>
<DIV>> >
> error: Cannot get namespaces for 1545:
Function not implemented</DIV>
<DIV>> > > The
instance id is 1544, but the error info hint cannot get ns for
1545.</DIV>
<DIV>> >
></DIV>
<DIV>> > </DIV>
<DIV>> > we have
two libvirt lxc related process at the first start,</DIV>
<DIV>> > one is
controller process on host(pid 1544), the other is the container's init
task(pid 1545).</DIV>
<DIV>> > since
lxc-enter-namespace wants to exec cmd in container environment. so</DIV>
<DIV>> > libvirt
will try to get the namespaces of container's init task.</DIV>
<DIV>> > </DIV>
<DIV>> > The
problem is libvirt/autoconf thinks your system doesn't support setns
system call...</DIV>
<DIV>> > </DIV>
<DIV>> > > The
libvirt code of mine is of version 1.1.4 from github (git checkout
v1.1.4 -b stable1.1.4 )</DIV>
<DIV>> >
></DIV>
<DIV>> > </DIV>
<DIV>> > I don't
know if the libvirt git repo on github is the right thing, but As I
know</DIV>
<DIV>> > this repo
git://libvirt.org/libvirt.git is official.</DIV>
<DIV>> > </DIV>
<DIV>> > Please
have a try.</DIV>
<DIV>> > </DIV>
<DIV>> > </DIV>
<DIV>> >
Thanks</DIV>
<DIV>> ></DIV>
<DIV>> > </DIV>
<DIV>> > Sorry, I made a mistake about the
libvirt repo, the code I used is just from the official repo.</DIV>
<DIV>> > Maybe it's problem of my kernel.
I've tried to build libvirt from code of master branch. The</DIV>
<DIV>> > mistake is just the same.</DIV>
<DIV>> > </DIV>
<DIV>> </DIV>
<DIV>> what's result of "./configure | grep
setns"</DIV>
<DIV>> </DIV>
<DIV>> </DIV>
<DIV>> </DIV>
<DIV>> </DIV>
<DIV>> The result is:</DIV>
<DIV>> hzguanqiang@debian:~/github/libvirt$
<mailto:hzguanqiang@debian:~/github/libvirt$> ./configure | grep
setns</DIV>
<DIV>> checking for setns... no</DIV>
<DIV>> </DIV>
<DIV>> Is there something need to configure for setns system call? Or
something is wrong with my kernel?</DIV>
<DIV>> </DIV>
<DIV> </DIV>
<DIV>Seem your kernel has setns, but autoconf doesn't recognise
it.</DIV>
<DIV>you can modify the config.h, change as below</DIV>
<DIV>#define HAVE_SETNS 1</DIV>
<DIV>and make && make install</DIV>
<DIV> </DIV></BLOCKQUOTE></TD></TR></TBODY></TABLE></DIV>
<DIV>Hi gaofeng,</DIV>
<DIV>I tried as you said, but it report an error when do make operation as
following:</DIV>
<DIV>
<DIV> </DIV>
<DIV>util/virprocess.c: In function 'virProcessSetNamespaces':</DIV>
<DIV>util/virprocess.c:568:9: error: implicit declaration of function 'setns'
[-Werror=implicit-function-declaration]</DIV>
<DIV>util/virprocess.c:568:9: error: nested extern declaration of 'setns'
[-Werror=nested-externs]</DIV>
<DIV>cc1: all warnings being treated as errors</DIV>
<DIV>make[3]: *** [util/libvirt_util_la-virprocess.lo] Error 1</DIV></DIV>
<DIV> </DIV>
<DIV>I think something must be wrong about setns system call in my
environment.</DIV>
<DIV>But still thanks very much for your help.</DIV>
<DIV> </DIV>
<DIV><SPAN>
<DIV style="FONT-FAMILY: verdana; FONT-SIZE: 10pt">
<DIV>------------------ <BR>Best
regards!<BR>GuanQiang</DIV></DIV></SPAN></DIV>
<DIV>17:34:55</DIV></BODY></HTML>