X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=python%2Fbwlimit.py;h=6892089cccd5d19bd547eda0c0a486ab20690dee;hb=67f86b9c416602d6c59da0303693194f610a1c32;hp=5c1716e4017f81079ed9888a926cdb0e7f4f8c53;hpb=5a78072c585e5eb7c1622f7c9091b8fb902ca5f1;p=util-vserver.git diff --git a/python/bwlimit.py b/python/bwlimit.py index 5c1716e..6892089 100644 --- a/python/bwlimit.py +++ b/python/bwlimit.py @@ -46,7 +46,7 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: bwlimit.py,v 1.13 2006/11/27 22:32:59 mlhuang Exp $ +# $Id: bwlimit.py,v 1.15 2007/02/07 04:21:11 mlhuang Exp $ # import sys, os, re, getopt @@ -349,7 +349,10 @@ def init(dev = dev, bwcap = bwmax): # by root end up here and are capped at the node bandwidth # cap. on(root_xid, dev, share = root_share) - file("/proc/sys/vnet/root_class", "w").write("%d" % ((1 << 16) | default_minor | root_xid)) + try: + file("/proc/sys/vnet/root_class", "w").write("%d" % ((1 << 16) | default_minor | root_xid)) + except: + pass # Set up the default class. Packets that fail classification end # up here. @@ -516,8 +519,12 @@ def on(xid, dev = dev, share = None, minrate = None, maxrate = None, minexemptra minrate = bwmin if minrate > maxrate: minrate = maxrate + if maxexemptrate < bwmin: + maxexemptrate = bwmin if maxexemptrate > bwmax: maxexemptrate = bwmax + if minexemptrate < bwmin: + minexemptrate = bwmin if minexemptrate > maxexemptrate: minexemptrate = maxexemptrate