From: Marc Fiuczynski Date: Mon, 11 Jul 2005 19:15:08 +0000 (+0000) Subject: Modified set_dlimit to print a warning message when trying to set a X-Git-Tag: after-util-vserver-0_30_208-revert~163 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=bf65db657ef73e2d1d62d2360bad415e987b5367;p=util-vserver.git Modified set_dlimit to print a warning message when trying to set a 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. --- diff --git a/python/vserver.py b/python/vserver.py index 2d72bd0..666ef00 100644 --- a/python/vserver.py +++ b/python/vserver.py @@ -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)