X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=bwmon.py;h=882b8f4ef8149fffc03b494dd2ced70a3f287a5a;hb=refs%2Fheads%2F1.5;hp=be7fe15a93aed4e10b0dfaf6c110c529c289fa28;hpb=b6e806fc73f0fa8f2526cc7d1e62245db814d725;p=nodemanager.git diff --git a/bwmon.py b/bwmon.py index be7fe15..882b8f4 100644 --- a/bwmon.py +++ b/bwmon.py @@ -15,7 +15,7 @@ # Faiyaz Ahmed # Copyright (C) 2004-2006 The Trustees of Princeton University # -# $Id$ +# $Id: bwmon.py,v 1.1.2.11 2007/06/26 18:03:55 faiyaza Exp $ # import os @@ -404,8 +404,6 @@ def gethtbs(root_xid, default_xid): name = bwlimit.get_slice(xid) - - if (name is None) \ and (xid != root_xid) \ and (xid != default_xid): @@ -458,11 +456,11 @@ def sync(nmdbcopy): (version, slices) = pickle.load(f) f.close() # Check version of data file - if version != "$Id$": + if version != "$Id: bwmon.py,v 1.1.2.11 2007/06/26 18:03:55 faiyaza Exp $": logger.log("bwmon: Not using old version '%s' data file %s" % (version, datafile)) raise Exception except Exception: - version = "$Id$" + version = "$Id: bwmon.py,v 1.1.2.11 2007/06/26 18:03:55 faiyaza Exp $" slices = {} # Get/set special slice IDs @@ -500,11 +498,17 @@ def sync(nmdbcopy): newslicesxids = Set(live.keys()) - Set(livehtbs.keys()) logger.log("bwmon: Found %s new slices" % newslicesxids.__len__()) - # Incase we rebooted and need to bring up the htbs that are in the db but - # not known to tc. - #nohtbxids = Set(slices.keys()) - Set(livehtbs.keys()) - #logger.log("bwmon: Found %s slices that should have htbs but dont." % nohtbxids.__len__()) - #newslicesxids.update(nohtbxids) + # Incase we rebooted and need to keep track of already running htbs + norecxids = Set(livehtbs.keys()) - Set(slices.keys()) + logger.log("bwmon: Found %s slices that have htbs but not in dat." % norecxids.__len__()) + # Reset tc counts. + for norecxid in norecxids: + slices[norecxid] = Slice(norecxid, live[norecxid]['name'], live[norecxid]['_rspec']) + slices[norecxid].reset(livehtbs[norecxid]['maxrate'], + livehtbs[norecxid]['maxexemptrate'], + livehtbs[norecxid]['usedbytes'], + livehtbs[norecxid]['usedi2bytes'], + live[norecxid]['_rspec']) # Setup new slices for newslice in newslicesxids: