From 97e8c474a8fbfc4727df2c584546b8286a81bd4e Mon Sep 17 00:00:00 2001 From: Peter Iannucci Date: Tue, 17 Feb 2009 02:16:12 -0500 Subject: [PATCH] Made some changes requested by Broder. svn path=/trunk/packages/invirt-database/; revision=2135 --- python/database/models.py | 4 ++-- python/database/owner.py | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/python/database/models.py b/python/database/models.py index 798934a..bd7f1cd 100644 --- a/python/database/models.py +++ b/python/database/models.py @@ -5,6 +5,8 @@ from sqlalchemy.orm import create_session, relation from sqlalchemy.ext.sessioncontext import SessionContext from sqlalchemy.ext.assignmapper import assign_mapper +from owner import Owner + __all__ = ['meta', 'session', 'clear_cache', @@ -130,8 +132,6 @@ class Autoinstall(object): def __repr__(self): return "" % (self.autoinstall_id, self.description, self.type.type_id) -from owner import Owner - session.mapper(Machine, machine_table, properties={'nics': relation(NIC, backref="machine"), 'disks': relation(Disk, backref="machine"), diff --git a/python/database/owner.py b/python/database/owner.py index b40dea5..f9e0128 100755 --- a/python/database/owner.py +++ b/python/database/owner.py @@ -9,7 +9,13 @@ class Owner(object): def __repr__(self): return """""" % (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: -- 1.7.9.5