Changeset 2213 for trunk/packages/invirt-database
- Timestamp:
- Feb 27, 2009, 2:18:03 PM (16 years ago)
- Location:
- trunk/packages/invirt-database
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/invirt-database/debian/changelog
r2211 r2213 1 invirt-database (0.1.9) unstable; urgency=low 2 3 * Make get*Quotas idempotent 4 * Move Owner import so that Owner can access session in 5 invirt.database.models 6 7 -- Quentin Smith <quentin@mit.edu> Fri, 27 Feb 2009 14:17:53 -0500 8 1 9 invirt-database (0.1.8) unstable; urgency=low 2 10 -
trunk/packages/invirt-database/python/database/models.py
r2211 r2213 7 7 8 8 from invirt.database import record 9 from invirt.database.owner import Owner10 9 11 10 __all__ = ['meta', … … 127 126 _identity_field = 'autoinstall_id' 128 127 128 from invirt.database.owner import Owner 129 129 130 session.mapper(Machine, machine_table, 130 131 properties={'nics': relation(NIC, backref="machine"), -
trunk/packages/invirt-database/python/database/owner.py
r2200 r2213 1 1 from invirt.database import record 2 from invirt.database.models import session 2 3 3 4 class Owner(record.Record): … … 18 19 @classmethod 19 20 def getMemoryQuotas(cls, owner): 20 owner_info = cls.query(). filter_by(owner_id=owner).first()21 owner_info = cls.query().get(owner) 21 22 if owner_info == None: 22 23 owner_info = cls(owner_id=owner) 24 session.expunge(owner_info) 23 25 return (owner_info.get('ram_quota_total'), owner_info.get('ram_quota_single')) 24 26 25 27 @classmethod 26 28 def getDiskQuotas(cls, owner): 27 owner_info = cls.query(). filter_by(owner_id=owner).first()29 owner_info = cls.query().get(owner) 28 30 if owner_info == None: 29 31 owner_info = cls(owner_id=owner) 32 session.expunge(owner_info) 30 33 return (owner_info.get('disk_quota_total'), owner_info.get('disk_quota_single')) 31 34 32 35 @classmethod 33 36 def getVMQuotas(cls, owner): 34 owner_info = cls.query(). filter_by(owner_id=owner).first()37 owner_info = cls.query().get(owner) 35 38 if owner_info == None: 36 39 owner_info = cls(owner_id=owner) 40 session.expunge(owner_info) 37 41 return (owner_info.get('vms_quota_total'), owner_info.get('vms_quota_active'))
Note: See TracChangeset
for help on using the changeset viewer.