class Owner(object):
def __repr__(self):
- return """<Owner %s: ram_quota_total=%s MB ram_quota_single=%s MB
-disk_quota_total=%s MB disk_quota_single=%s MB
-vms_quota_total=%s vms_quota_active=%s >""" % (self.owner_id, self.ram_quota_total, self.ram_quota_single, self.disk_quota_total, self.disk_quota_single, self.vms_quota_total, self.vms_quota_active)
+ a = self.ram_quota_total
+ b = self.ram_quota_single
+ c = self.disk_quota_total
+ d = self.disk_quota_single
+ e = self.vms_quota_total
+ f = self.vms_quota_active
+ if not a:
+ a = MAX_MEMORY_TOTAL
+ if not b:
+ b = MAX_MEMORY_SINGLE
+ if not c:
+ c = MAX_DISK_TOTAL
+ if not d:
+ d = MAX_DISK_SINGLE
+ if not e:
+ e = MAX_VMS_TOTAL
+ if not f:
+ f = MAX_VMS_ACTIVE
+ return """<Owner %s: ram_quota_total=%s MiB ram_quota_single=%s MiB
+disk_quota_total=%s GiB disk_quota_single=%s GiB
+vms_quota_total=%s vms_quota_active=%s >""" % (self.owner_id, a,b,c,d,e,f)
def getMemoryQuotas(owner):
owner_info = Owner.query().filter_by(owner_id=owner).first()
if owner_info != None:
quota_active = MAX_VMS_ACTIVE
else:
quota_total = MAX_VMS_TOTAL
- quota_single = MAX_VMS_ACTIVE
+ quota_active = MAX_VMS_ACTIVE
return (quota_total, quota_active)
getVMQuotas = staticmethod(getVMQuotas)