Re: [Vserver] Mounting /vservers/vs, prepre-start script and namespace

From: Herbert Poetzl <herbert_at_13thfloor.at>
Date: Tue 21 Nov 2006 - 19:48:42 GMT
Message-ID: <20061121194842.GB26903@MAIL.13thfloor.at>

On Tue, Nov 21, 2006 at 06:39:17PM +0100, Xavier Montagutelli wrote:
> On Tuesday 21 November 2006 14:06, Daniel Hokka Zakrisson wrote:
> > Xavier Montagutelli wrote:
> > > Hello list,
> > > I would like to execute a script before the vserver start. This
> > > script will be in charge of mounting the /vservers/<vs> filesystem
> > > (ext3 on a cluster-LVM logical volume).
> > >
> > > I tried using a prepre-start.d script, but it seems this part is
> > > executed in the vserver namespace (I don't use the 'nonamespace'
> > > feature). So the FS is correctly mounted, but I would prefer it to
> > > be mounted in the host namespace.
> > >
> > > Is there a way to achieve this with the current util-vserver
> > > release ? Or do I have to implement a sort of preprepre-start
> > > feature ? Or did I miss something ?
> >
> > The namespace is created as one of the first steps of the process.
> > The vserver script executes itself within a new namespace before it
> > has even handed over control to the vserver.start script, and thus
> > any such scriptlets would have to be hacked into the main vserver
> > script.
> >
> > Also note that 0.30.211 does have an initialize script which is run
> > basically as soon as vserver.start is in control, but even then
> > you're in the guest's namespace.
>
> OK, thank you for your answer.
>
> So I will have to patch the vserver utility or wrap the "vserver" call
> in another script.
>
> Another question : I don't figure out completely the namespaces.
> Why does "vnamespace -e 0 ..." doesn't work to escape from the newly
> created namespace ?

that's quite simple: by default, each process has a
potential for a private namespace. on guest creation,
we create such a new namespace by means of clone()
with the proper clone flags, and shortly after that,
we create a context with vserver(). once that exists
we 'assign' the namespace of the current process to
the context ...

now when you issues vnamespace -e <xid> ... the tools
basically lookup the context <xid> and throw you into
the 'remembered' namespace. natrually, this only works
for existing contexts (i.e. ones you created before)
and not for special context numbers like 0 or 1, which
are not represented by a context structure at all

even if they were, it would be hard to tell what
namespace you want to enter (with xid=0) as there can
be many of them ...

HTC,
Herbert

> --
> Xavier Montagutelli Tel : +33 (0)5 55 45 77 20
> Service Commun Informatique Fax : +33 (0)5 55 45 75 95
> Universite de Limoges
> 123, avenue Albert Thomas
> 87060 Limoges cedex
> _______________________________________________
> Vserver mailing list
> Vserver@list.linux-vserver.org
> http://list.linux-vserver.org/mailman/listinfo/vserver
_______________________________________________
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver
Received on Tue Nov 21 19:51:17 2006

[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Tue 21 Nov 2006 - 19:51:23 GMT by hypermail 2.1.8