X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/eabe84bd3f3ea514893ec700d598a06c2418f37e..47b9cb0d87524e6598da025f3c49cd013f00606b:/code/validation.py?ds=inline diff --git a/code/validation.py b/code/validation.py index 18666be..26a49a3 100755 --- a/code/validation.py +++ b/code/validation.py @@ -107,9 +107,10 @@ def maxDisk(owner, machine=None): machine_id = machine.machine_id else: machine_id = None - disk_usage = Disk.query.filter(Disk.c.machine_id != machine_id).\ - join('machine').\ - filter_by(owner=owner).sum(Disk.c.size) or 0 + disk_usage_query = Disk.query.filter(Disk.machine_id != machine_id).\ + join('machine').filter_by(owner=owner) + + disk_usage = sum([m.size for m in disk_usage_query]) or 0 return min(quota_single, quota_total-disk_usage/1024.) def cantAddVm(owner, g):