svn path=/trunk/packages/invirt-web/; revision=2132
import re
import string
import dns.resolver
import re
import string
import dns.resolver
-from invirt.database import Machine, NIC, Type, Disk, CDROM, Autoinstall
+from invirt.database import Machine, NIC, Type, Disk, CDROM, Autoinstall, Owner
from invirt.config import structs as config
from invirt.common import InvalidInput, CodeError
from invirt.config import structs as config
from invirt.common import InvalidInput, CodeError
-MAX_MEMORY_TOTAL = 512
-MAX_MEMORY_SINGLE = 512
MIN_MEMORY_SINGLE = 16
MAX_DISK_TOTAL = 50
MAX_DISK_SINGLE = 50
MIN_MEMORY_SINGLE = 16
MAX_DISK_TOTAL = 50
MAX_DISK_SINGLE = 50
memory for the machine to change to, if it is left off, is
returned.
"""
memory for the machine to change to, if it is left off, is
returned.
"""
- if machine is not None and machine.memory > MAX_MEMORY_SINGLE:
- # If they've been blessed, let them have it
- return machine.memory
+ (quota_total, quota_single) = Owner.getQuotas(machine.owner if machine else owner)
+
- return MAX_MEMORY_SINGLE
machines = getMachinesByOwner(owner, machine)
active_machines = [m for m in machines if m.name in g.xmlist_raw]
mem_usage = sum([x.memory for x in active_machines if x != machine])
machines = getMachinesByOwner(owner, machine)
active_machines = [m for m in machines if m.name in g.xmlist_raw]
mem_usage = sum([x.memory for x in active_machines if x != machine])
- return min(MAX_MEMORY_SINGLE, MAX_MEMORY_TOTAL-mem_usage)
+ return min(quota_single, quota_total-mem_usage)
def maxDisk(owner, machine=None):
"""Return the maximum disk that a machine can reach.
def maxDisk(owner, machine=None):
"""Return the maximum disk that a machine can reach.
+invirt-web (0.0.19) unstable; urgency=low
+
+ * modified quota checking to refer to invirt.database.Owner for quotas and defaults
+
+ -- Peter A. Iannucci <iannucci@mit.edu> Mon, 16 Feb 2009 23:49:21 -0500
+
invirt-web (0.0.18) unstable; urgency=low
* depend on apache2, libapache2-mod-auth-sslcert, python-dnspython
invirt-web (0.0.18) unstable; urgency=low
* depend on apache2, libapache2-mod-auth-sslcert, python-dnspython