About this list Date view Thread view Subject view Author view Attachment view

From: Ola Lundqvist (opal_at_debian.org)
Date: Tue 21 Dec 2004 - 19:20:12 GMT


Hello

On Tue, Dec 21, 2004 at 07:25:35PM +0100, Bjoern Steinbrink wrote:
*SNIP*
> > Some analysis:
> >
> > /usr/sbin/vserver script:
> >
> > Context of new vserver is set
> > - by /etc/vservers/name.conf
> > - or by /var/run/vservers/name.ctx
> > - or by the chcontext script itself
> >
> > "running" is evaluated by:
> > - /var/run/vservers/name.ctx lockfile exists?
> > - (vps ax | grep context | wc -l) >0 ?
> >
> > 1) Checking for running vserver in "start" makes
> > no sense because .ctx files are never deleted
> > and it's possible that other vserver has same
> > context and is already running.
> > So the result of "running" is running even
> > if other vserver is started in this context.
>
> What's the sense in having two or more vservers sharing the same
> context? It may occur with vserver's having a dynamic context id that a
> context id gets reused, but you should use static context ids anyway.

Two vservers should never share them. The problem is (as you already know)
is when you use dynamic contexts and when they get reused. The problem
occur on power-failure and in some cases when vservers are restarted.
I agree that this problem do not happen when you use static contexts but
that is as far as I know not mandatory.

> And even if there's another vserver running in the same context, do you
> really want a second vserver to be started in that context? I doubt it.
> So IMHO checking if the vserver is running before starting it is fine in
> the way it is done right now.

I thought so too until Helmut Toplitzer <helmut_at_ifit.uni-klu.ac.at>
convinced me. I think it is better to ask him, so I cc him with this mail.

> >
> > 2) Deleting vservers .ctx file makes no sense
> > either because it can be missed by a hard reboot,
> > kill, etc.
> >
>
> And it's not necessary, if no process is actually running in the context
> whose id is stored in the .ctx file, the vserver is considered "not
> runnning".

This is not always true.

Consider the following lines in the vserver script:
elif [ "$2" = "running" ] ; then
        if [ ! -f /var/run/vservers/$1.ctx ] ; then
                echo Server $1 is not running
                exit 1
        else
                ... the good check ...

So if this server is not started before at all (no ctx file) and
another vserver is running with the same ctx id you may get a problem.
I think this is the reason he got his problem.

> > 3) Solution: before starting any vserver test
> > for ALL vservers if they are running and remove
> > remaining .ctx files of not running ones.
> > Once booted into the schema everything should work.
> > (hopefully *sigh*)
>
> Now where's the difference, apart from the fact that all outdated .ctx
> files are removed? Your patch removes exactly those files that would not
> lead to the result that a vserver is considered running...

The problem is that you can get wrong hostname set when a context
file with same ctx id is in that directory.

Other solutions are of course appriciated. I'm just interested
in that the problem that Helmut has presented a reproducable
test case to go away. :)

Regards,

// Ola

> Regards
> Bjoern
>
>

-- 
 --------------------- Ola Lundqvist ---------------------------
/  opal_at_debian.org                     Annebergsslingan 37      \
|  opal_at_lysator.liu.se                 654 65 KARLSTAD          |
|  +46 (0)54-10 14 30                  +46 (0)70-332 1551       |
|  http://www.opal.dhs.org             UIN/icq: 4912500         |
\  gpg/f.p.: 7090 A92B 18FE 7994 0C36  4FE4 18A1 B1CF 0FE5 3DD9 /
 ---------------------------------------------------------------
_______________________________________________
Vserver mailing list
Vserver_at_list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver


About this list Date view Thread view Subject view Author view Attachment view
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Tue 21 Dec 2004 - 19:23:55 GMT by hypermail 2.1.3