source: trunk/packages/invirt-database/python/database/owner.py @ 2132

Last change on this file since 2132 was 2132, checked in by iannucci, 15 years ago

RAM quotas at remctl; RAM quota exception script, table, and usage in -web and -remote-create; /etc/nocreate support

  • Property svn:executable set to *
File size: 817 bytes
Line 
1MAX_MEMORY_TOTAL = 512
2MAX_MEMORY_SINGLE = 512
3class Owner(object):
4    def __repr__(self):
5        return "<Owner %s: ram_quota_total=%s MB ram_quota_single=%s MB>" % (self.owner_id, self.ram_quota_total, self.ram_quota_single)
6    def getQuotas(owner):
7        owner_info = Owner.query().filter_by(owner_id=owner).first()
8        if owner_info != None:
9            quota_total = owner_info.ram_quota_total
10            if quota_total == None:
11                quota_total = MAX_MEMORY_TOTAL
12            quota_single = owner_info.ram_quota_single
13            if quota_single == None:
14                quota_single = MAX_MEMORY_SINGLE
15        else:
16            quota_total = MAX_MEMORY_TOTAL
17            quota_single = MAX_MEMORY_SINGLE
18        return (quota_total, quota_single)
19    getQuotas = staticmethod(getQuotas)
Note: See TracBrowser for help on using the repository browser.