- def __do_chcontext(self, state_file):
-
- if state_file:
- print >>state_file, "%u" % self.ctx
- state_file.close()
-
- if vserverimpl.chcontext(self.ctx, vserverimpl.text2bcaps(self.get_capabilities_config())):
- self.set_resources(True)
- vserverimpl.setup_done(self.ctx)
-
-
- def __prep(self, runlevel):
-
- """ Perform all the crap that the vserver script does before
- actually executing the startup scripts. """
-
-
- # set the initial runlevel
- vserverimpl.setrunlevel(self.dir + "/var/run/utmp", runlevel)
-
- # mount /proc and /dev/pts
- self.__do_mount("none", self.dir, "/proc", "proc")
- # XXX - magic mount options
- self.__do_mount("none", self.dir, "/dev/pts", "devpts", 0, "gid=5,mode=0620")
-
-
- def __cleanvar(self):
- """
- Clean the /var/ directory so RH startup scripts can run
- """
-
- RUNDIR = "/var/run"
- LOCKDIR = "/var/lock/subsys"
-
- filter = ["utmp"]
- garbage = []
- for topdir in [RUNDIR, LOCKDIR]:
- #os.walk() = (dirpath, dirnames, filenames)
- for root, dirs, files in os.walk(topdir):
- for file in files:
- if not file in filter:
- garbage.append(root + "/" + file)
-
- for f in garbage: os.unlink(f)
- return garbage
-
-
- def __do_mount(self, *mount_args):
- try:
- vserverimpl.mount(*mount_args)
- except OSError, ex:
- if ex.errno == errno.EBUSY:
- # assume already mounted
- return
- raise ex
-
-