Remove the useless User class (now user is a string)
[invirt/packages/invirt-web.git] / templates / controls.py
index 1e769b0..3671f21 100644 (file)
@@ -87,14 +87,14 @@ def unregisterMachine(machine):
     """Unregister a machine to not be controlled by the web interface"""
     remctl('web', 'unregister', machine.name)
 
-def createVm(user, name, memory, disk, is_hvm, cdrom):
+def createVm(owner, contact, name, memory, disk, is_hvm, cdrom):
     """Create a VM and put it in the database"""
     # put stuff in the table
     transaction = ctx.current.create_transaction()
     try:
-        validation.validMemory(user, memory)
-        validation.validDisk(user, disk  * 1. / 1024)
-        validation.validAddVm(user)
+        validation.validMemory(owner, memory)
+        validation.validDisk(owner, disk  * 1. / 1024)
+        validation.validAddVm(owner)
         res = meta.engine.execute('select nextval('
                                   '\'"machines_machine_id_seq"\')')
         id = res.fetchone()[0]
@@ -102,9 +102,9 @@ def createVm(user, name, memory, disk, is_hvm, cdrom):
         machine.machine_id = id
         machine.name = name
         machine.memory = memory
-        machine.owner = user.username
-        machine.administrator = user.username
-        machine.contact = user.email
+        machine.owner = owner
+        machine.administrator = owner
+        machine.contact = contact
         machine.uuid = uuidToString(randomUUID())
         machine.boot_off_cd = True
         machine_type = Type.get_by(hvm=is_hvm)