+invirt-database (0.1.9) unstable; urgency=low
+
+ * Make get*Quotas idempotent
+ * Move Owner import so that Owner can access session in
+ invirt.database.models
+
+ -- Quentin Smith <quentin@mit.edu> Fri, 27 Feb 2009 14:17:53 -0500
+
invirt-database (0.1.8) unstable; urgency=low
[Peter Iannucci]
from sqlalchemy.ext.assignmapper import assign_mapper
from invirt.database import record
-from invirt.database.owner import Owner
__all__ = ['meta',
'session',
class Autoinstall(record.Record):
_identity_field = 'autoinstall_id'
+from invirt.database.owner import Owner
+
session.mapper(Machine, machine_table,
properties={'nics': relation(NIC, backref="machine"),
'disks': relation(Disk, backref="machine"),
from invirt.database import record
+from invirt.database.models import session
class Owner(record.Record):
_f = {
@classmethod
def getMemoryQuotas(cls, owner):
- owner_info = cls.query().filter_by(owner_id=owner).first()
+ owner_info = cls.query().get(owner)
if owner_info == None:
owner_info = cls(owner_id=owner)
+ session.expunge(owner_info)
return (owner_info.get('ram_quota_total'), owner_info.get('ram_quota_single'))
@classmethod
def getDiskQuotas(cls, owner):
- owner_info = cls.query().filter_by(owner_id=owner).first()
+ owner_info = cls.query().get(owner)
if owner_info == None:
owner_info = cls(owner_id=owner)
+ session.expunge(owner_info)
return (owner_info.get('disk_quota_total'), owner_info.get('disk_quota_single'))
@classmethod
def getVMQuotas(cls, owner):
- owner_info = cls.query().filter_by(owner_id=owner).first()
+ owner_info = cls.query().get(owner)
if owner_info == None:
owner_info = cls(owner_id=owner)
+ session.expunge(owner_info)
return (owner_info.get('vms_quota_total'), owner_info.get('vms_quota_active'))