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 2135)
@@ -8,5 +8,5 @@
 Examples:
 
-    invirt-setquota joeuser -mt 512 -ms None
+    invirt-setquota joeuser -mt 512 -ms -1
 """
 
@@ -15,101 +15,91 @@
 from optparse import OptionParser
 
-class invirt_exception(Exception): pass
+def main(argv):
+    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()
 
-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()
+    if len(args) != 1:
+        print >> stderr, __doc__.strip()
+        return 1
+    owner = args[0]
+    connect()
+    session.begin()
+    
+    x = Owner.query().filter_by(owner_id=owner).first()
+    if x == None:
+        x = Owner(owner_id=owner, ram_quota_total=None, ram_quota_single=None,
+                  disk_quota_total=None, disk_quota_single=None,
+                  vms_quota_total=None, vms_quota_active)
 
-        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()
+    if opts.memtotal != None:
+        total = int(opts.memtotal)
+        if total == -1:
+            x.ram_quota_total = None
+        else:
+            x.ram_quota_total = total
 
-        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
 
-        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
 
-        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
 
-        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
 
-        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
 
-        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
+    session.commit()
+    print str(x)
+    return 0
 
 if __name__ == '__main__':
Index: /trunk/packages/invirt-database/python/database/models.py
===================================================================
--- /trunk/packages/invirt-database/python/database/models.py	(revision 2134)
+++ /trunk/packages/invirt-database/python/database/models.py	(revision 2135)
@@ -5,4 +5,6 @@
 from sqlalchemy.ext.sessioncontext import SessionContext
 from sqlalchemy.ext.assignmapper import assign_mapper
+
+from owner import Owner
 
 __all__ = ['meta',
@@ -131,6 +133,4 @@
         return "<Autoinstall %s: %s (%s)>" % (self.autoinstall_id, self.description, self.type.type_id)
 
-from owner import Owner
-
 session.mapper(Machine, machine_table,
               properties={'nics': relation(NIC, backref="machine"),
Index: /trunk/packages/invirt-database/python/database/owner.py
===================================================================
--- /trunk/packages/invirt-database/python/database/owner.py	(revision 2134)
+++ /trunk/packages/invirt-database/python/database/owner.py	(revision 2135)
@@ -10,5 +10,11 @@
         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)
+vms_quota_total=%s vms_quota_active=%s >""" % (self.owner_id, 
+               self.ram_quota_total if self.ram_quota_total else MAX_MEMORY_TOTAL,
+               self.ram_quota_single if self.ram_quota_single else MAX_MEMORY_SINGLE, 
+               self.disk_quota_total if self.disk_quota_total else MAX_DISK_TOTAL,
+               self.disk_quota_single if self.disk_quota_single else MAX_DISK_SINGLE, 
+               self.vms_quota_total if self.vms_quota_total else MAX_VMS_TOTAL,
+               self.vms_quota_active if self.vms_quota_active else MAX_VMS_ACTIVE)
     def getMemoryQuotas(owner):
         owner_info = Owner.query().filter_by(owner_id=owner).first()
Index: /trunk/packages/invirt-remote/debian/changelog
===================================================================
--- /trunk/packages/invirt-remote/debian/changelog	(revision 2134)
+++ /trunk/packages/invirt-remote/debian/changelog	(revision 2135)
@@ -1,2 +1,8 @@
+invirt-remote (0.3.5) unstable; urgency=low
+
+  * updated quota support to refer to renamed owner table columns
+
+ -- Peter A. Iannucci <iannucci@mit.edu>  Tue, 17 Feb 2009 02:13:44 -0500
+
 invirt-remote (0.3.4) 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 2134)
+++ /trunk/packages/invirt-remote/server/usr/sbin/invirt-remote-create	(revision 2135)
@@ -24,5 +24,5 @@
     active_machines = [m for m in machines if m.name in xmlist]
     mem_usage = sum([x.memory for x in active_machines])
-    return min(quota_single, quota_total-mem_usage)
+    return min(quota_single, quota_total - mem_usage)
 
 def choose_host():
@@ -38,5 +38,7 @@
     machine_name = argv[2]
     args = argv[3:]
-    
+
+    invirt.database.connect()
+
     if operation == 'install':
         options = dict(arg.split('=', 1) for arg in args)
@@ -63,5 +65,4 @@
 
     if operation == "create":
-        invirt.database.connect()
         machine = invirt.database.Machine.query().filter_by(name=machine_name).first()
 
