mount /proc before chroot'ing into filesystem.
authorFaiyaz Ahmed <faiyaza@cs.princeton.edu>
Fri, 14 Dec 2007 18:50:13 +0000 (18:50 +0000)
committerFaiyaz Ahmed <faiyaza@cs.princeton.edu>
Fri, 14 Dec 2007 18:50:13 +0000 (18:50 +0000)
python/vserver.py

index dbb7853..65d9c62 100644 (file)
@@ -381,7 +381,7 @@ class VServer:
             self.set_resources()
             vserverimpl.setup_done(self.ctx)
 
             self.set_resources()
             vserverimpl.setup_done(self.ctx)
 
-    def __prep(self, runlevel, log):
+    def __prep(self, runlevel):
 
         """ Perform all the crap that the vserver script does before
         actually executing the startup scripts. """
 
         """ Perform all the crap that the vserver script does before
         actually executing the startup scripts. """
@@ -444,6 +444,10 @@ class VServer:
                 if fd != 0:
                     os.dup2(fd, 0)
                     os.close(fd)
                 if fd != 0:
                     os.dup2(fd, 0)
                     os.close(fd)
+                # perform pre-init cleanup
+                self.__prep(runlevel)
+
                 self.config.cache_it()
                 self.__do_chroot()
                 log = open("/var/log/boot.log", "a", 0)
                 self.config.cache_it()
                 self.__do_chroot()
                 log = open("/var/log/boot.log", "a", 0)
@@ -453,10 +457,6 @@ class VServer:
 
                 print >>log, ("%s: starting the virtual server %s" %
                               (time.asctime(time.gmtime()), self.name))
 
                 print >>log, ("%s: starting the virtual server %s" %
                               (time.asctime(time.gmtime()), self.name))
-
-                # perform pre-init cleanup
-                self.__prep(runlevel, log)
-
                 # execute each init script in turn
                 # XXX - we don't support all scripts that vserver script does
                 self.__do_chcontext(state_file)
                 # execute each init script in turn
                 # XXX - we don't support all scripts that vserver script does
                 self.__do_chcontext(state_file)