X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sm.py;h=11c9ee71952dbfe4a45a382f41549b834a601b8c;hb=7ad7efcc3865f3feb58269fbd53f47efc4ec1327;hp=919b72a2f1807c682878ddeef9f4c7d05b447beb;hpb=f9913ce7d0b97c1d2ee566cfa73ba76a865f9968;p=nodemanager.git diff --git a/sm.py b/sm.py index 919b72a..11c9ee7 100644 --- a/sm.py +++ b/sm.py @@ -38,6 +38,8 @@ DEFAULT_ALLOCATION = { 'net_i2_thresh_kbyte': 13757316, # disk space limit 'disk_max': 5000000, # bytes + # capabilities + 'capabilities': '', # NOTE: this table is further populated with resource names and # default amounts via the start() function below. This probably @@ -163,7 +165,12 @@ def GetSlivers(data, fullupdate=True): rec['rspec'] = rspec for resname, default_amt in DEFAULT_ALLOCATION.iteritems(): try: amt = int(attr_dict[resname]) - except (KeyError, ValueError): amt = default_amt + except KeyError: amt = default_amt + except ValueError: + if type(default_amt) is type('str'): + amt = attr_dict[resname] + else: + amt = default_amt rspec[resname] = amt # disable sliver