@@ -1580,6 +1580,8 @@ public VMTemplateVO createPrivateTemplate(CreateTemplateCmd command) throws Clou
15801580 // Specify RAW format makes it unusable for snapshots.
15811581 privateTemplate .setFormat (ImageFormat .RAW );
15821582 }
1583+ Transaction txn = Transaction .currentTxn ();
1584+ txn .start ();
15831585 String checkSum = getChecksum (secondaryStorageHost .getId (), answer .getPath ());
15841586 privateTemplate .setChecksum (checkSum );
15851587 _templateDao .update (templateId , privateTemplate );
@@ -1598,7 +1600,7 @@ public VMTemplateVO createPrivateTemplate(CreateTemplateCmd command) throws Clou
15981600 UsageEventVO usageEvent = new UsageEventVO (EventTypes .EVENT_TEMPLATE_CREATE , privateTemplate .getAccountId (), secondaryStorageHost .getDataCenterId (), privateTemplate .getId (),
15991601 privateTemplate .getName (), null , privateTemplate .getSourceTemplateId (), templateHostVO .getSize ());
16001602 _usageEventDao .persist (usageEvent );
1601-
1603+ txn . commit ();
16021604 }
16031605 } finally {
16041606 if (privateTemplate == null ) {
@@ -2320,7 +2322,7 @@ public UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serv
23202322 return createVirtualMachine (zone , serviceOffering , template , hostName , displayName , owner , diskOfferingId , diskSize , networkList , null , group , userData , sshKeyPair , hypervisor , caller , requestedIps , defaultIp );
23212323 }
23222324
2323- @ ActionEvent (eventType = EventTypes .EVENT_VM_CREATE , eventDescription = "deploying Vm" , create = true )
2325+ @ DB @ ActionEvent (eventType = EventTypes .EVENT_VM_CREATE , eventDescription = "deploying Vm" , create = true )
23242326 protected UserVm createVirtualMachine (DataCenter zone , ServiceOffering serviceOffering , VirtualMachineTemplate template , String hostName , String displayName , Account owner , Long diskOfferingId ,
23252327 Long diskSize , List <NetworkVO > networkList , List <Long > securityGroupIdList , String group , String userData , String sshKeyPair , HypervisorType hypervisor , Account caller , Map <Long , String > requestedIps , String defaultNetworkIp ) throws InsufficientCapacityException , ResourceUnavailableException , ConcurrentOperationException , StorageUnavailableException , ResourceAllocationException {
23262328
@@ -2498,7 +2500,8 @@ protected UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOf
24982500 } else {
24992501 hypervisorType = template .getHypervisorType ();
25002502 }
2501-
2503+ Transaction txn = Transaction .currentTxn ();
2504+ txn .start ();
25022505 UserVmVO vm = new UserVmVO (id , instanceName , displayName , template .getId (), hypervisorType , template .getGuestOSId (), offering .getOfferHA (), offering .getLimitCpuUse (), owner .getDomainId (), owner .getId (),
25032506 offering .getId (), userData , hostName );
25042507
@@ -2527,7 +2530,7 @@ protected UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOf
25272530 _usageEventDao .persist (usageEvent );
25282531
25292532 _accountMgr .incrementResourceCount (accountId , ResourceType .user_vm );
2530-
2533+ txn . commit ();
25312534 // Assign instance to the group
25322535 try {
25332536 if (group != null ) {
0 commit comments