Changeset 2134 for trunk/packages/invirt-database
- Timestamp:
- Feb 17, 2009, 1:54:26 AM (16 years ago)
- Location:
- trunk/packages/invirt-database
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/invirt-database/debian/changelog
r2132 r2134 1 1 invirt-database (0.1.3) unstable; urgency=low 2 2 3 * Added owner table with ram quotas.3 * Added owner table to database with ram, disk, and VM quotas 4 4 * Refactored Owner class into separate sourcefile 5 5 6 -- Peter A. Iannucci <iannucci@mit.edu> Mon, 16 Feb 2009 23:49:39-05006 -- Peter A. Iannucci <iannucci@mit.edu> Tue, 17 Feb 2009 01:31:53 -0500 7 7 8 8 invirt-database (0.1.2) unstable; urgency=low -
trunk/packages/invirt-database/python/database/models.py
r2132 r2134 88 88 Column('owner_id', String, primary_key=True, nullable=False), 89 89 Column('ram_quota_total', Integer, nullable=True), 90 Column('ram_quota_single', Integer, nullable=True)) 90 Column('ram_quota_single', Integer, nullable=True), 91 Column('disk_quota_total', Integer, nullable=True), 92 Column('disk_quota_single', Integer, nullable=True), 93 Column('vms_quota_total', Integer, nullable=True), 94 Column('vms_quota_active', Integer, nullable=True)) 91 95 92 96 machine_access_table = Table('machine_access', meta, -
trunk/packages/invirt-database/python/database/owner.py
r2132 r2134 1 1 MAX_MEMORY_TOTAL = 512 2 2 MAX_MEMORY_SINGLE = 512 3 MAX_DISK_TOTAL = 50 4 MAX_DISK_SINGLE = 50 5 MAX_VMS_TOTAL = 10 6 MAX_VMS_ACTIVE = 4 7 3 8 class Owner(object): 4 9 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): 10 return """<Owner %s: ram_quota_total=%s MB ram_quota_single=%s MB 11 disk_quota_total=%s MB disk_quota_single=%s MB 12 vms_quota_total=%s vms_quota_active=%s >""" % (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) 13 def getMemoryQuotas(owner): 7 14 owner_info = Owner.query().filter_by(owner_id=owner).first() 8 15 if owner_info != None: … … 17 24 quota_single = MAX_MEMORY_SINGLE 18 25 return (quota_total, quota_single) 19 getQuotas = staticmethod(getQuotas) 26 getMemoryQuotas = staticmethod(getMemoryQuotas) 27 def getDiskQuotas(owner): 28 owner_info = Owner.query().filter_by(owner_id=owner).first() 29 if owner_info != None: 30 quota_total = owner_info.disk_quota_total 31 if quota_total == None: 32 quota_total = MAX_DISK_TOTAL 33 quota_single = owner_info.disk_quota_single 34 if quota_single == None: 35 quota_single = MAX_DISK_SINGLE 36 else: 37 quota_total = MAX_DISK_TOTAL 38 quota_single = MAX_DISK_SINGLE 39 return (quota_total, quota_single) 40 getDiskQuotas = staticmethod(getDiskQuotas) 41 def getVMQuotas(owner): 42 owner_info = Owner.query().filter_by(owner_id=owner).first() 43 if owner_info != None: 44 quota_total = owner_info.vms_quota_total 45 if quota_total == None: 46 quota_total = MAX_VMS_TOTAL 47 quota_active = owner_info.vms_quota_active 48 if quota_active == None: 49 quota_active = MAX_VMS_ACTIVE 50 else: 51 quota_total = MAX_VMS_TOTAL 52 quota_single = MAX_VMS_ACTIVE 53 return (quota_total, quota_active) 54 getVMQuotas = staticmethod(getVMQuotas)
Note: See TracChangeset
for help on using the changeset viewer.