Changeset 2132
- Timestamp:
- Feb 16, 2009, 11:52:01 PM (16 years ago)
- Location:
- trunk/packages
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/invirt-base/debian/changelog
r2097 r2132 1 invirt-base (0.0.21) unstable; urgency=low 2 3 * added invirt-setquota script (self-documenting) 4 5 -- Peter A. Iannucci <iannucci@mit.edu> Mon, 16 Feb 2009 23:48:25 -0500 6 1 7 invirt-base (0.0.20) unstable; urgency=low 2 8 -
trunk/packages/invirt-database/debian/changelog
r1962 r2132 1 invirt-database (0.1.3) unstable; urgency=low 2 3 * Added owner table with ram quotas. 4 * Refactored Owner class into separate sourcefile 5 6 -- Peter A. Iannucci <iannucci@mit.edu> Mon, 16 Feb 2009 23:49:39 -0500 7 1 8 invirt-database (0.1.2) unstable; urgency=low 2 9 -
trunk/packages/invirt-database/python/database/models.py
r1714 r2132 17 17 'mirrors_table', 18 18 'autoinstalls_table', 19 'owners_table', 19 20 'Machine', 20 21 'MachineAccess', … … 25 26 'Mirror', 26 27 'Autoinstall', 28 'Owner', 27 29 'or_', 28 30 ] … … 83 85 Column('arch', String, nullable=False)) 84 86 87 owners_table = Table('owners', meta, 88 Column('owner_id', String, primary_key=True, nullable=False), 89 Column('ram_quota_total', Integer, nullable=True), 90 Column('ram_quota_single', Integer, nullable=True)) 91 85 92 machine_access_table = Table('machine_access', meta, 86 93 Column('machine_id', Integer, ForeignKey('machines.machine_id', ondelete='CASCADE'), nullable=False, index=True), … … 120 127 return "<Autoinstall %s: %s (%s)>" % (self.autoinstall_id, self.description, self.type.type_id) 121 128 129 from owner import Owner 130 122 131 session.mapper(Machine, machine_table, 123 132 properties={'nics': relation(NIC, backref="machine"), … … 133 142 properties={'mirror': relation(Mirror, backref="cdroms")}) 134 143 session.mapper(Autoinstall, autoinstalls_table) 144 session.mapper(Owner, owners_table) 135 145 136 146 def clear_cache(): -
trunk/packages/invirt-remote/debian/changelog
r2113 r2132 2 2 3 3 * modified host/usr/sbin/invirt-availability and invirt-vmcontrol to stat 4 /etc/invirt/nocreate; if it exists, they advertise zero free memory and 4 /etc/invirt/nocreate; if it exists, they advertise zero free memory and 5 5 refuse to create VMs 6 7 -- Peter A. Iannucci <iannucci@mit.edu> Sat, 14 Feb 2009 18:10:54 -0500 6 * added memory quota validation to invirt-remote-create 7 * added owner table to database with ram_quota_total and ram_quota_single 8 9 -- Peter A. Iannucci <iannucci@mit.edu> Mon, 16 Feb 2009 23:49:14 -0500 8 10 9 11 invirt-remote (0.3.3) unstable; urgency=low -
trunk/packages/invirt-remote/server/usr/sbin/invirt-remote-create
r2106 r2132 13 13 import sys 14 14 import yaml 15 import invirt.database 16 17 def maxMemory(owner, xmlist): 18 """ 19 Return the memory available for a new machine. 20 """ 21 machines = invirt.database.Machine.query().filter_by(owner=owner) 22 (quota_total, quota_single) = invirt.database.Owner.getQuotas(owner) 23 24 active_machines = [m for m in machines if m.name in xmlist] 25 mem_usage = sum([x.memory for x in active_machines]) 26 return min(quota_single, quota_total-mem_usage) 15 27 16 28 def choose_host(): … … 50 62 return 1 51 63 64 if operation == "create": 65 invirt.database.connect() 66 machine = invirt.database.Machine.query().filter_by(name=machine_name).first() 67 68 owner = machine.owner 69 vm_memory = machine.memory 70 71 max_memory = maxMemory(owner, vms.keys()) 72 if vm_memory > max_memory: 73 print >>sys.stderr, "owner %s requested %d MB of memory for vm %s; %d MB allowed" % (owner, vm_memory, machine_name, max_memory) 74 return 1 75 52 76 host = choose_host() 53 77 print 'Creating on host %s...' % host -
trunk/packages/invirt-web/code/validation.py
r2064 r2132 6 6 import string 7 7 import dns.resolver 8 from invirt.database import Machine, NIC, Type, Disk, CDROM, Autoinstall 8 from invirt.database import Machine, NIC, Type, Disk, CDROM, Autoinstall, Owner 9 9 from invirt.config import structs as config 10 10 from invirt.common import InvalidInput, CodeError 11 11 12 MAX_MEMORY_TOTAL = 51213 MAX_MEMORY_SINGLE = 51214 12 MIN_MEMORY_SINGLE = 16 15 13 MAX_DISK_TOTAL = 50 … … 92 90 returned. 93 91 """ 94 if machine is not None and machine.memory > MAX_MEMORY_SINGLE: 95 # If they've been blessed, let them have it 96 return machine.memory 92 (quota_total, quota_single) = Owner.getQuotas(machine.owner if machine else owner) 93 97 94 if not on: 98 return MAX_MEMORY_SINGLE95 return quota_single 99 96 machines = getMachinesByOwner(owner, machine) 100 97 active_machines = [m for m in machines if m.name in g.xmlist_raw] 101 98 mem_usage = sum([x.memory for x in active_machines if x != machine]) 102 return min( MAX_MEMORY_SINGLE, MAX_MEMORY_TOTAL-mem_usage)99 return min(quota_single, quota_total-mem_usage) 103 100 104 101 def maxDisk(owner, machine=None): -
trunk/packages/invirt-web/debian/changelog
r2063 r2132 1 invirt-web (0.0.19) unstable; urgency=low 2 3 * modified quota checking to refer to invirt.database.Owner for quotas and defaults 4 5 -- Peter A. Iannucci <iannucci@mit.edu> Mon, 16 Feb 2009 23:49:21 -0500 6 1 7 invirt-web (0.0.18) unstable; urgency=low 2 8
Note: See TracChangeset
for help on using the changeset viewer.