Ignore:
Timestamp:
Feb 27, 2009, 2:18:03 PM (16 years ago)
Author:
quentin
Message:

Fix get*Quotas

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-database/python/database/owner.py

    r2200 r2213  
    11from invirt.database import record
     2from invirt.database.models import session
    23
    34class Owner(record.Record):
     
    1819    @classmethod
    1920    def getMemoryQuotas(cls, owner):
    20         owner_info = cls.query().filter_by(owner_id=owner).first()
     21        owner_info = cls.query().get(owner)
    2122        if owner_info == None:
    2223            owner_info = cls(owner_id=owner)
     24            session.expunge(owner_info)
    2325        return (owner_info.get('ram_quota_total'), owner_info.get('ram_quota_single'))
    2426
    2527    @classmethod
    2628    def getDiskQuotas(cls, owner):
    27         owner_info = cls.query().filter_by(owner_id=owner).first()
     29        owner_info = cls.query().get(owner)
    2830        if owner_info == None:
    2931            owner_info = cls(owner_id=owner)
     32            session.expunge(owner_info)
    3033        return (owner_info.get('disk_quota_total'), owner_info.get('disk_quota_single'))
    3134
    3235    @classmethod
    3336    def getVMQuotas(cls, owner):
    34         owner_info = cls.query().filter_by(owner_id=owner).first()
     37        owner_info = cls.query().get(owner)
    3538        if owner_info == None:
    3639            owner_info = cls(owner_id=owner)
     40            session.expunge(owner_info)
    3741        return (owner_info.get('vms_quota_total'), owner_info.get('vms_quota_active'))
Note: See TracChangeset for help on using the changeset viewer.