Merge from head.
authorFaiyaz Ahmed <faiyaza@cs.princeton.edu>
Thu, 26 Apr 2007 19:09:05 +0000 (19:09 +0000)
committerFaiyaz Ahmed <faiyaza@cs.princeton.edu>
Thu, 26 Apr 2007 19:09:05 +0000 (19:09 +0000)
bwmon.py
database.py

index 07006f1..c2c9ffe 100644 (file)
--- a/bwmon.py
+++ b/bwmon.py
@@ -15,7 +15,7 @@
 # Faiyaz Ahmed <faiyaza@cs.princeton.edu>
 # Copyright (C) 2004-2006 The Trustees of Princeton University
 #
-# $Id$
+# $Id: bwmon.py,v 1.1.2.8 2007/04/25 22:20:58 faiyaza Exp $
 #
 
 import os
@@ -45,7 +45,7 @@ bits_per_byte = 8
 
 # Defaults
 debug = False
-verbose = True 
+verbose = False
 datafile = "/var/lib/misc/bwmon.dat"
 #nm = None
 
@@ -417,11 +417,11 @@ def GetSlivers(db):
         (version, slices) = pickle.load(f)
         f.close()
         # Check version of data file
-        if version != "$Id$":
+        if version != "$Id: bwmon.py,v 1.1.2.8 2007/04/25 22:20:58 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.8 2007/04/25 22:20:58 faiyaza Exp $"
         slices = {}
 
     # Get/set special slice IDs
@@ -519,13 +519,8 @@ def GetSlivers(db):
         else:
             # Just in case.  Probably (hopefully) this will never happen.
             # New slice, initialize state
-            logger.log("bwmon: New Slice %s" % name)
-            slice = slices[xid] = Slice(xid, name, db[slice.name]['_rspec'])
-            slice.reset(maxrate, \
-                maxexemptrate, \
-                usedbytes, \
-                usedi2bytes, \
-                db[slice.name]['_rspec'])
+            logger.log("bwmon: Deleting orphaned slice xid %s" % xid)
+            bwlimit.off(xid)
 
     # Delete dead slices
     dead = Set(slices.keys()) - Set(live.keys())
index 878a7ba..7b95ed2 100644 (file)
@@ -103,7 +103,8 @@ class Database(dict):
         for name, rec in self.iteritems():
             if rec['instantiation'] == 'plc-instantiated': accounts.get(name).ensure_created(rec)
 
-        bwmon.GetSlivers(self)
+        try: bwmon.GetSlivers(self)
+        except: logger.log_exc()
 
         # request a database dump
         global dump_requested