Optimization in case the context is already running.
[util-vserver-pl.git] / python / vserver.py
index e638149..7652b78 100644 (file)
@@ -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,