Modified set_dlimit to print a warning message when trying to set a
authorMarc Fiuczynski <mef@cs.princeton.edu>
Mon, 11 Jul 2005 19:15:08 +0000 (19:15 +0000)
committerMarc Fiuczynski <mef@cs.princeton.edu>
Mon, 11 Jul 2005 19:15:08 +0000 (19:15 +0000)
disk limit (in blocks) that is smaller than the number of blocks
the vserver is already using.  Should probably be an exception in
the future.

python/vserver.py

index 2d72bd0..666ef00 100644 (file)
@@ -84,7 +84,14 @@ class VServer:
     def set_dlimit(self, blocktotal):
         path = "%s/%s" % (VROOTDIR, self.name)
         inodes, blockcount, size = vduimpl.vdu(path)
-        vserverimpl.setdlimit(path, self.ctx, blockcount>>1, blocktotal, inodes, -1, 2)
+        blockcount = blockcount >> 1
+
+        if blocktotal > blockcount:
+            vserverimpl.setdlimit(path, self.ctx, blockcount>>1, \
+                                  blocktotal, inodes, -1, 2)
+        else:
+            # should raise some error value
+            print "block limit (%d) ignored for vserver %s" %(blocktotal,self.name)
 
     def get_dlimit(self):
         path = "%s/%s" % (VROOTDIR, self.name)