Hello

I forward this bugreport that I have got from
Helmut Toplitzer <[EMAIL PROTECTED]> that fix a problem
with context misunderstanding at start of a vserver.

It is a quite simple patch and as far as I have tested it works fine.

It is applied to the debian version of util-vserver.

For full information see http://bugs.debian.org/280723

Regards,

// Ola

----- Forwarded message from Helmut Toplitzer <[EMAIL PROTECTED]> -----

Envelope-to: [EMAIL PROTECTED]
Delivery-date: Mon, 15 Nov 2004 16:30:57 +0100
From: Helmut Toplitzer <[EMAIL PROTECTED]>
Organization: University of Klagenfurt
To: [EMAIL PROTECTED]
Subject: Re: Bug#280723: [util-vserver]: vserver-stat shows wrong server as 
started one
Cc: [EMAIL PROTECTED]
X-UID: 82
X-Length: 1861
X-OriginalArrivalTime: 15 Nov 2004 15:31:56.0343 (UTC) 
FILETIME=[3D751470:01C4CB28]
X-Spamcheck-Provider: Checked for spam by OpaL, [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.64 (2004-01-11) on bixbite.opal.dhs.org
X-Spam-Level: 
X-Spam-Status: No, hits=0.0 required=4.0 tests=none autolearn=no version=2.64


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.

2) Deleting vservers .ctx file makes no sense 
   either because it can be missed by a hard reboot,
   kill, etc.

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*)

   Everything should be ok now ... if there's 
   already an appropriate locking mechanism so
   that it's impossible to start 2 instances of
   vserver on different vservers. (didn't checked
   for that. but this should be a problem anyhow)
   that's my 2c.


-- 
My GNUpg fingerprint http://www.gnupg.org
4563 F4FB 0B7E 8698 53CD  00E9 E319 35BD 6A91 1656 
---------------------------------------------------
please visit:
http://www.ifi.uni-klu.ac.at/Conferences/ER2005
http://www.ifi.uni-klu.ac.at/Conferences/SPICE2005
---------------------------------------------------

--- vserver.orig        Mon Nov 15 16:15:04 2004
+++ vserver     Mon Nov 15 16:18:14 2004
@@ -307,6 +307,20 @@
        # context limit than fiddling with ulimit
        #ulimit -H -n $NFILE -v $VMEM
 }
+
+check_consistency()
+{
+       for serv in /var/run/vservers/*.ctx
+       do
+               unset S_CONTEXT
+               . $serv
+               NB=$($USR_SBIN/vps ax | awk '{print $2}' | grep \^$S_CONTEXT\$ 
| wc -l)
+               if [ "$NB" -eq 0 ] ; then
+                       rm $serv
+               fi
+       done
+}
+
 if [ $# -lt 2 ] ; then
        usage
 elif [ "$2" = "build" ] ; then
@@ -474,6 +488,7 @@
        exit 1
 elif [ "$2" = "start" ] ; then
        echo Starting the virtual server $1
+       check_consistency
        testperm $1
        if ! $VSERVER_CMD $1 running
        then


----- End forwarded message -----

-- 
 --------------------- Ola Lundqvist ---------------------------
/  [EMAIL PROTECTED]                     Annebergsslingan 37      \
|  [EMAIL PROTECTED]                 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
[EMAIL PROTECTED]
http://list.linux-vserver.org/mailman/listinfo/vserver

Reply via email to