Fixed yasb
authorPeter Iannucci <iannucci@mit.edu>
Tue, 17 Feb 2009 07:54:57 +0000 (02:54 -0500)
committerPeter Iannucci <iannucci@mit.edu>
Tue, 17 Feb 2009 07:54:57 +0000 (02:54 -0500)
svn path=/trunk/packages/invirt-database/; revision=2143

python/database/owner.py

index 58e3772..8526c22 100755 (executable)
@@ -7,15 +7,27 @@ MAX_VMS_ACTIVE = 4
 
 class Owner(object):
     def __repr__(self):
 
 class Owner(object):
     def __repr__(self):
+        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 MB ram_quota_single=%s MB
 disk_quota_total=%s MB disk_quota_single=%s MB
         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 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)
+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:
     def getMemoryQuotas(owner):
         owner_info = Owner.query().filter_by(owner_id=owner).first()
         if owner_info != None: