+ if operation == "create":
+ invirt.database.connect()
+ machine = invirt.database.Machine.query().filter_by(name=machine_name).first()
+
+ owner = machine.owner
+ vm_memory = machine.memory
+
+ max_memory = maxMemory(owner, vms.keys())
+ if vm_memory > max_memory:
+ print >>sys.stderr, "owner %s requested %d MB of memory for vm %s; %d MB allowed" % (owner, vm_memory, machine_name, max_memory)
+ return 1
+