From 82e135b9c84782a1a0aa9aafd0b084b23450ae35 Mon Sep 17 00:00:00 2001 From: Peter Iannucci Date: Mon, 16 Feb 2009 23:52:01 -0500 Subject: [PATCH] RAM quotas at remctl; RAM quota exception script, table, and usage in -web and -remote-create; /etc/nocreate support svn path=/trunk/packages/invirt-web/; revision=2132 --- code/validation.py | 13 +++++-------- debian/changelog | 6 ++++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/code/validation.py b/code/validation.py index 5f2a3ff..05e4c27 100644 --- a/code/validation.py +++ b/code/validation.py @@ -5,12 +5,10 @@ import getafsgroups 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 -MAX_MEMORY_TOTAL = 512 -MAX_MEMORY_SINGLE = 512 MIN_MEMORY_SINGLE = 16 MAX_DISK_TOTAL = 50 MAX_DISK_SINGLE = 50 @@ -91,15 +89,14 @@ def maxMemory(owner, g, machine=None, on=True): 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) + if not on: - return MAX_MEMORY_SINGLE + return quota_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]) - 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. diff --git a/debian/changelog b/debian/changelog index f007ec3..d746e43 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +invirt-web (0.0.19) unstable; urgency=low + + * modified quota checking to refer to invirt.database.Owner for quotas and defaults + + -- Peter A. Iannucci 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 -- 1.7.9.5