When creating a new VM, create the disks in the try/except block so
authorEvan Broder <broder@mit.edu>
Fri, 17 Apr 2009 16:51:42 +0000 (12:51 -0400)
committerEvan Broder <broder@mit.edu>
Fri, 17 Apr 2009 16:51:42 +0000 (12:51 -0400)
that everything gets rolled back if that fails.

svn path=/trunk/packages/invirt-web/; revision=2295

code/controls.py

index 911c41a..e32b1c2 100644 (file)
@@ -105,11 +105,11 @@ def createVm(username, state, owner, contact, name, description, memory, disksiz
         session.save_or_update(nic)
         session.save_or_update(disk)
         cache_acls.refreshMachine(machine)
+        makeDisks(machine)
         session.commit()
     except:
         session.rollback()
         raise
-    makeDisks(machine)
     try:
         if autoinstall:
             lvinstall(machine, autoinstall)