X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=python%2Fvserver.py;h=7652b784c5b1d99c06db7d7c3839958a73345c32;hb=5d32782d7fd7141309464b18678ee16b92af6686;hp=33c195298ba93dcf54da359f290f21adc7f1365c;hpb=466e46958ff78e49fd5d168392a7388aa2c34672;p=util-vserver-pl.git diff --git a/python/vserver.py b/python/vserver.py index 33c1952..7652b78 100644 --- a/python/vserver.py +++ b/python/vserver.py @@ -435,16 +435,16 @@ class VServer: # XXX - we don't support all scripts that vserver script does self.__do_chcontext(state_file) for cmd in self.INITSCRIPTS: - try: - # enter vserver context - arg_subst = { 'runlevel': runlevel } - cmd_args = [cmd[0]] + map(lambda x: x % arg_subst, + try: + # enter vserver context + arg_subst = { 'runlevel': runlevel } + cmd_args = [cmd[0]] + map(lambda x: x % arg_subst, cmd[1:]) - print >>log, "executing '%s'" % " ".join(cmd_args) - os.spawnvp(os.P_NOWAIT,cmd[0],cmd_args) - except: - print >>log, traceback.format_exc() - os._exit(1) + if os.path.isfile(cmd[0]): + print >>log, "executing '%s'" % " ".join(cmd_args) + os.spawnvp(os.P_NOWAIT,cmd[0],cmd_args) + except: + print >>log, traceback.format_exc() # we get here due to an exception in the top-level child process except Exception, ex: @@ -459,6 +459,13 @@ class VServer: pass def init_disk_info(self): + try: + dlimit = vserver.getdlimit(self.dir, self.ctx) + self.disk_blocks = dlimit[0] + self.disk_inodes = dlimit[2] + return self.disk_blocks * 1024 + except Exception, e: + pass cmd = "/usr/sbin/vdu --script --space --inodes --blocksize 1024 --xid %d %s" % (self.ctx, self.dir) p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,