2 MAX_MEMORY_SINGLE = 512
10 a = self.ram_quota_total
11 b = self.ram_quota_single
12 c = self.disk_quota_total
13 d = self.disk_quota_single
14 e = self.vms_quota_total
15 f = self.vms_quota_active
28 return """<Owner %s: ram_quota_total=%s MiB ram_quota_single=%s MiB
29 disk_quota_total=%s GiB disk_quota_single=%s GiB
30 vms_quota_total=%s vms_quota_active=%s >""" % (self.owner_id, a,b,c,d,e,f)
31 def getMemoryQuotas(owner):
32 owner_info = Owner.query().filter_by(owner_id=owner).first()
33 if owner_info != None:
34 quota_total = owner_info.ram_quota_total
35 if quota_total == None:
36 quota_total = MAX_MEMORY_TOTAL
37 quota_single = owner_info.ram_quota_single
38 if quota_single == None:
39 quota_single = MAX_MEMORY_SINGLE
41 quota_total = MAX_MEMORY_TOTAL
42 quota_single = MAX_MEMORY_SINGLE
43 return (quota_total, quota_single)
44 getMemoryQuotas = staticmethod(getMemoryQuotas)
45 def getDiskQuotas(owner):
46 owner_info = Owner.query().filter_by(owner_id=owner).first()
47 if owner_info != None:
48 quota_total = owner_info.disk_quota_total
49 if quota_total == None:
50 quota_total = MAX_DISK_TOTAL
51 quota_single = owner_info.disk_quota_single
52 if quota_single == None:
53 quota_single = MAX_DISK_SINGLE
55 quota_total = MAX_DISK_TOTAL
56 quota_single = MAX_DISK_SINGLE
57 return (quota_total, quota_single)
58 getDiskQuotas = staticmethod(getDiskQuotas)
59 def getVMQuotas(owner):
60 owner_info = Owner.query().filter_by(owner_id=owner).first()
61 if owner_info != None:
62 quota_total = owner_info.vms_quota_total
63 if quota_total == None:
64 quota_total = MAX_VMS_TOTAL
65 quota_active = owner_info.vms_quota_active
66 if quota_active == None:
67 quota_active = MAX_VMS_ACTIVE
69 quota_total = MAX_VMS_TOTAL
70 quota_active = MAX_VMS_ACTIVE
71 return (quota_total, quota_active)
72 getVMQuotas = staticmethod(getVMQuotas)