Fixed another stupid bug.
[invirt/packages/invirt-database.git] / python / database / owner.py
index b40dea5..58e3772 100755 (executable)
@@ -9,7 +9,13 @@ 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
     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)
+vms_quota_total=%s vms_quota_active=%s >""" % (self.owner_id, 
+               self.ram_quota_total if self.ram_quota_total else MAX_MEMORY_TOTAL,
+               self.ram_quota_single if self.ram_quota_single else MAX_MEMORY_SINGLE, 
+               self.disk_quota_total if self.disk_quota_total else MAX_DISK_TOTAL,
+               self.disk_quota_single if self.disk_quota_single else MAX_DISK_SINGLE, 
+               self.vms_quota_total if self.vms_quota_total else MAX_VMS_TOTAL,
+               self.vms_quota_active if self.vms_quota_active else MAX_VMS_ACTIVE)
     def getMemoryQuotas(owner):
         owner_info = Owner.query().filter_by(owner_id=owner).first()
         if owner_info != None:
     def getMemoryQuotas(owner):
         owner_info = Owner.query().filter_by(owner_id=owner).first()
         if owner_info != None:
@@ -49,6 +55,6 @@ vms_quota_total=%s vms_quota_active=%s >""" % (self.owner_id, self.ram_quota_tot
                 quota_active = MAX_VMS_ACTIVE
         else:
             quota_total = MAX_VMS_TOTAL
                 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)
         return (quota_total, quota_active)
     getVMQuotas = staticmethod(getVMQuotas)