git://git.onelab.eu
/
nodemanager.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
520a8ca
)
cleaner type support
author
Daniel Hokka Zakrisson
<dhokka@cs.princeton.edu>
Tue, 24 Jul 2007 15:59:04 +0000
(15:59 +0000)
committer
Daniel Hokka Zakrisson
<dhokka@cs.princeton.edu>
Tue, 24 Jul 2007 15:59:04 +0000
(15:59 +0000)
sm.py
patch
|
blob
|
history
diff --git
a/sm.py
b/sm.py
index
d3812fc
..
12e906c
100644
(file)
--- a/
sm.py
+++ b/
sm.py
@@
-7,7
+7,7
@@
also to make inter-sliver resource loans. The sliver manager is also
responsible for handling delegation accounts.
"""
responsible for handling delegation accounts.
"""
-# $Id: sm.py,v 1.2
5 2007/07/20 19:35:29
faiyaza Exp $
+# $Id: sm.py,v 1.2
6 2007/07/23 19:28:07
faiyaza Exp $
try: from bwlimit import bwmin, bwmax
except ImportError: bwmin, bwmax = 8, 1000*1000*1000
try: from bwlimit import bwmin, bwmax
except ImportError: bwmin, bwmax = 8, 1000*1000*1000
@@
-119,13
+119,10
@@
def GetSlivers(data, fullupdate=True):
rspec = {}
rec['rspec'] = rspec
for resname, default_amt in DEFAULT_ALLOCATION.iteritems():
rspec = {}
rec['rspec'] = rspec
for resname, default_amt in DEFAULT_ALLOCATION.iteritems():
- try: amt = int(attr_dict[resname])
- except KeyError: amt = default_amt
- except ValueError:
- if type(default_amt) is type('str'):
- amt = attr_dict[resname]
- else:
- amt = default_amt
+ try:
+ t = type(default_amt)
+ amt = t.__new__(t, attr_dict[resname])
+ except (KeyError, ValueError): amt = default_amt
rspec[resname] = amt
database.db.deliver_record(rec)
rspec[resname] = amt
database.db.deliver_record(rec)