Index: trunk/packages/invirt-base/debian/changelog
===================================================================
--- trunk/packages/invirt-base/debian/changelog	(revision 2133)
+++ trunk/packages/invirt-base/debian/changelog	(revision 2134)
@@ -3,5 +3,5 @@
   * added invirt-setquota script (self-documenting)
 
- -- Peter A. Iannucci <iannucci@mit.edu>  Mon, 16 Feb 2009 23:48:25 -0500
+ -- Peter A. Iannucci <iannucci@mit.edu>  Tue, 17 Feb 2009 01:43:54 -0500
 
 invirt-base (0.0.20) unstable; urgency=low
Index: trunk/packages/invirt-base/scripts/invirt-setquota
===================================================================
--- trunk/packages/invirt-base/scripts/invirt-setquota	(revision 2133)
+++ 	(revision )
@@ -1,67 +1,0 @@
-#!/usr/bin/env python
-
-"""
-invirt-setquota allows an administrator to set the RAM quotas for an owner.
-Invoking with only an owner name returns the current quotas for that owner.
-Setting a parameter to -1 restores the default.
-
-Examples:
-
-    invirt-setquota joeuser -t 512 -s None
-"""
-
-from invirt.database import *
-from sys import argv, exit, stderr, stdout
-from optparse import OptionParser
-
-class invirt_exception(Exception): pass
-
-def main(argv):
-    try:
-        parser = OptionParser(usage = '%prog owner [options]',
-                description = __doc__.strip().split('\n\n')[0])
-        parser.add_option('-t', '--total',
-                type = 'int',
-                dest = 'total',
-                help = 'set the total concurrent RAM quota')
-        parser.add_option('-s', '--single',
-                type = 'int',
-                dest = 'single',
-                help = 'set the single VM RAM quota')
-        opts, args = parser.parse_args()
-
-        if len(args) != 1:
-            raise invirt_exception(__doc__.strip())
-        owner = args[0]
-        connect()
-        session.begin()
-        
-        x = Owner.query().filter_by(owner_id=owner).first()
-
-        edited = False
-        if opts.total != None:
-            total = int(opts.total)
-            if total == -1:
-                x.ram_quota_total = None
-            else:
-                x.ram_quota_total = total
-            edited = True
-
-        if opts.single != None:
-            single = int(opts.single)
-            if single == -1:
-                x.ram_quota_single = None
-            else:
-                x.ram_quota_single = single
-            edited = True
-
-        if edited:
-            session.commit()
-        print str(x)
-
-    except invirt_exception, ex:
-        print >> stderr, ex
-        return 1
-
-if __name__ == '__main__':
-    exit(main(argv))
Index: trunk/packages/invirt-base/scripts/invirt-setquotas
===================================================================
--- trunk/packages/invirt-base/scripts/invirt-setquotas	(revision 2134)
+++ trunk/packages/invirt-base/scripts/invirt-setquotas	(revision 2134)
@@ -0,0 +1,116 @@
+#!/usr/bin/env python
+
+"""
+invirt-setquota allows an administrator to set memory, disk, and VM quotas 
+for an owner.  Invoking with only an owner name returns the current quotas for
+that owner.  Setting a parameter to -1 restores the default.
+
+Examples:
+
+    invirt-setquota joeuser -mt 512 -ms None
+"""
+
+from invirt.database import *
+from sys import argv, exit, stderr, stdout
+from optparse import OptionParser
+
+class invirt_exception(Exception): pass
+
+def main(argv):
+    try:
+        parser = OptionParser(usage = '%prog owner [options]',
+                description = __doc__.strip().split('\n\n')[0])
+        parser.add_option('-m', '--mem-total',
+                type = 'int',
+                dest = 'memtotal',
+                help = 'set total concurrent RAM quota')
+        parser.add_option('-n', '--mem-single',
+                type = 'int',
+                dest = 'memsingle',
+                help = 'set single VM RAM quota')
+        parser.add_option('-d', '--disk-total',
+                type = 'int',
+                dest = 'disktotal',
+                help = 'set total disk quota')
+        parser.add_option('-e', '--disk-single',
+                type = 'int',
+                dest = 'disksingle',
+                help = 'set single VM disk quota')
+        parser.add_option('-v', '--vms-total',
+                type = 'int',
+                dest = 'vmstotal',
+                help = 'set total VM quota')
+        parser.add_option('-w', '--vms-active',
+                type = 'int',
+                dest = 'vmsactive',
+                help = 'set active VM quota')
+        opts, args = parser.parse_args()
+
+        print opts
+        if len(args) != 1:
+            raise invirt_exception(__doc__.strip())
+        owner = args[0]
+        connect()
+        session.begin()
+        
+        x = Owner.query().filter_by(owner_id=owner).first()
+
+        edited = False
+        if opts.memtotal != None:
+            total = int(opts.memtotal)
+            if total == -1:
+                x.ram_quota_total = None
+            else:
+                x.ram_quota_total = total
+            edited = True
+
+        if opts.memsingle != None:
+            single = int(opts.memsingle)
+            if single == -1:
+                x.ram_quota_single = None
+            else:
+                x.ram_quota_single = single
+            edited = True
+
+        if opts.disktotal != None:
+            total = int(opts.disktotal)
+            if total == -1:
+                x.disk_quota_total = None
+            else:
+                x.disk_quota_total = total
+            edited = True
+
+        if opts.disksingle != None:
+            single = int(opts.disksingle)
+            if single == -1:
+                x.disk_quota_single = None
+            else:
+                x.disk_quota_single = single
+            edited = True
+
+        if opts.vmstotal != None:
+            total = int(opts.vmstotal)
+            if total == -1:
+                x.vms_quota_total = None
+            else:
+                x.vms_quota_total = total
+            edited = True
+
+        if opts.vmsactive != None:
+            active = int(opts.vmsactive)
+            if active == -1:
+                x.vms_quota_active = None
+            else:
+                x.vms_quota_active = active
+            edited = True
+
+        if edited:
+            session.commit()
+        print str(x)
+
+    except invirt_exception, ex:
+        print >> stderr, ex
+        return 1
+
+if __name__ == '__main__':
+    exit(main(argv))
Index: trunk/packages/invirt-database/debian/changelog
===================================================================
--- trunk/packages/invirt-database/debian/changelog	(revision 2133)
+++ trunk/packages/invirt-database/debian/changelog	(revision 2134)
@@ -1,8 +1,8 @@
 invirt-database (0.1.3) unstable; urgency=low
 
-  * Added owner table with ram quotas.
+  * Added owner table to database with ram, disk, and VM quotas
   * Refactored Owner class into separate sourcefile
 
- -- Peter A. Iannucci <iannucci@mit.edu>  Mon, 16 Feb 2009 23:49:39 -0500
+ -- Peter A. Iannucci <iannucci@mit.edu>  Tue, 17 Feb 2009 01:31:53 -0500
 
 invirt-database (0.1.2) unstable; urgency=low
Index: trunk/packages/invirt-database/python/database/models.py
===================================================================
--- trunk/packages/invirt-database/python/database/models.py	(revision 2133)
+++ trunk/packages/invirt-database/python/database/models.py	(revision 2134)
@@ -88,5 +88,9 @@
        Column('owner_id', String, primary_key=True, nullable=False),
        Column('ram_quota_total', Integer, nullable=True),
-       Column('ram_quota_single', Integer, nullable=True))
+       Column('ram_quota_single', Integer, nullable=True),
+       Column('disk_quota_total', Integer, nullable=True),
+       Column('disk_quota_single', Integer, nullable=True),
+       Column('vms_quota_total', Integer, nullable=True),
+       Column('vms_quota_active', Integer, nullable=True))
 
 machine_access_table = Table('machine_access', meta,
Index: trunk/packages/invirt-database/python/database/owner.py
===================================================================
--- trunk/packages/invirt-database/python/database/owner.py	(revision 2133)
+++ trunk/packages/invirt-database/python/database/owner.py	(revision 2134)
@@ -1,8 +1,15 @@
 MAX_MEMORY_TOTAL = 512
 MAX_MEMORY_SINGLE = 512
+MAX_DISK_TOTAL = 50
+MAX_DISK_SINGLE = 50
+MAX_VMS_TOTAL = 10
+MAX_VMS_ACTIVE = 4
+
 class Owner(object):
     def __repr__(self):
-        return "<Owner %s: ram_quota_total=%s MB ram_quota_single=%s MB>" % (self.owner_id, self.ram_quota_total, self.ram_quota_single)
-    def getQuotas(owner):
+        return """<Owner %s: ram_quota_total=%s MB ram_quota_single=%s MB
+disk_quota_total=%s MB disk_quota_single=%s MB
+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)
+    def getMemoryQuotas(owner):
         owner_info = Owner.query().filter_by(owner_id=owner).first()
         if owner_info != None:
@@ -17,3 +24,31 @@
             quota_single = MAX_MEMORY_SINGLE
         return (quota_total, quota_single)
-    getQuotas = staticmethod(getQuotas)
+    getMemoryQuotas = staticmethod(getMemoryQuotas)
+    def getDiskQuotas(owner):
+        owner_info = Owner.query().filter_by(owner_id=owner).first()
+        if owner_info != None:
+            quota_total = owner_info.disk_quota_total
+            if quota_total == None:
+                quota_total = MAX_DISK_TOTAL
+            quota_single = owner_info.disk_quota_single
+            if quota_single == None:
+                quota_single = MAX_DISK_SINGLE
+        else:
+            quota_total = MAX_DISK_TOTAL
+            quota_single = MAX_DISK_SINGLE
+        return (quota_total, quota_single)
+    getDiskQuotas = staticmethod(getDiskQuotas)
+    def getVMQuotas(owner):
+        owner_info = Owner.query().filter_by(owner_id=owner).first()
+        if owner_info != None:
+            quota_total = owner_info.vms_quota_total
+            if quota_total == None:
+                quota_total = MAX_VMS_TOTAL
+            quota_active = owner_info.vms_quota_active
+            if quota_active == None:
+                quota_active = MAX_VMS_ACTIVE
+        else:
+            quota_total = MAX_VMS_TOTAL
+            quota_single = MAX_VMS_ACTIVE
+        return (quota_total, quota_active)
+    getVMQuotas = staticmethod(getVMQuotas)
Index: trunk/packages/invirt-remote/debian/changelog
===================================================================
--- trunk/packages/invirt-remote/debian/changelog	(revision 2133)
+++ trunk/packages/invirt-remote/debian/changelog	(revision 2134)
@@ -5,7 +5,6 @@
     refuse to create VMs
   * added memory quota validation to invirt-remote-create
-  * added owner table to database with ram_quota_total and ram_quota_single
-
- -- Peter A. Iannucci <iannucci@mit.edu>  Mon, 16 Feb 2009 23:49:14 -0500
+
+ -- Peter A. Iannucci <iannucci@mit.edu>  Tue, 17 Feb 2009 01:31:20 -0500
 
 invirt-remote (0.3.3) unstable; urgency=low
Index: trunk/packages/invirt-remote/server/usr/sbin/invirt-remote-create
===================================================================
--- trunk/packages/invirt-remote/server/usr/sbin/invirt-remote-create	(revision 2133)
+++ trunk/packages/invirt-remote/server/usr/sbin/invirt-remote-create	(revision 2134)
@@ -20,5 +20,5 @@
     """
     machines = invirt.database.Machine.query().filter_by(owner=owner)
-    (quota_total, quota_single) = invirt.database.Owner.getQuotas(owner)
+    (quota_total, quota_single) = invirt.database.Owner.getMemoryQuotas(owner)
 
     active_machines = [m for m in machines if m.name in xmlist]
Index: trunk/packages/invirt-web/code/validation.py
===================================================================
--- trunk/packages/invirt-web/code/validation.py	(revision 2133)
+++ trunk/packages/invirt-web/code/validation.py	(revision 2134)
@@ -11,9 +11,5 @@
 
 MIN_MEMORY_SINGLE = 16
-MAX_DISK_TOTAL = 50
-MAX_DISK_SINGLE = 50
 MIN_DISK_SINGLE = 0.1
-MAX_VMS_TOTAL = 10
-MAX_VMS_ACTIVE = 4
 
 class Validate:
@@ -90,5 +86,5 @@
     returned.
     """
-    (quota_total, quota_single) = Owner.getQuotas(machine.owner if machine else owner)
+    (quota_total, quota_single) = Owner.getMemoryQuotas(machine.owner if machine else owner)
 
     if not on:
@@ -105,4 +101,6 @@
     return the maximum that a given machine can be changed to.
     """
+    (quota_total, quota_single) = Owner.getDiskQuotas(machine.owner if machine else owner)
+
     if machine is not None:
         machine_id = machine.machine_id
@@ -112,12 +110,13 @@
                      join('machine').\
                      filter_by(owner=owner).sum(Disk.c.size) or 0
-    return min(MAX_DISK_SINGLE, MAX_DISK_TOTAL-disk_usage/1024.)
+    return min(quota_single, quota_total-disk_usage/1024.)
 
 def cantAddVm(owner, g):
     machines = getMachinesByOwner(owner)
     active_machines = [m for m in machines if m.name in g.xmlist_raw]
-    if machines.count() >= MAX_VMS_TOTAL:
+    (quota_total, quota_active) = Owner.getVMQuotas(machine.owner if machine else owner)
+    if machines.count() >= quota_total:
         return 'You have too many VMs to create a new one.'
-    if len(active_machines) >= MAX_VMS_ACTIVE:
+    if len(active_machines) >= quota_active:
         return ('You already have the maximum number of VMs turned on.  '
                 'To create more, turn one off.')
Index: trunk/packages/invirt-web/debian/changelog
===================================================================
--- trunk/packages/invirt-web/debian/changelog	(revision 2133)
+++ trunk/packages/invirt-web/debian/changelog	(revision 2134)
@@ -3,5 +3,5 @@
   * 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
+ -- Peter A. Iannucci <iannucci@mit.edu>  Tue, 17 Feb 2009 01:31:01 -0500
 
 invirt-web (0.0.18) unstable; urgency=low
