abh1sar commented on code in PR #11560:
URL: https://github.com/apache/cloudstack/pull/11560#discussion_r2330512208


##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -9612,20 +9615,15 @@ public UserVm 
allocateVMFromBackup(CreateVMFromBackupCmd cmd) throws Insufficien
     @Override
     public UserVm restoreVMFromBackup(CreateVMFromBackupCmd cmd) throws 
ResourceUnavailableException, InsufficientCapacityException, 
ResourceAllocationException {
         long vmId = cmd.getEntityId();
+        UserVm vm;
         Map<Long, DiskOffering> diskOfferingMap = 
cmd.getDataDiskTemplateToDiskOfferingMap();
         Map<VirtualMachineProfile.Param, Object> additonalParams = new 
HashMap<>();
-        UserVm vm;
+        
additonalParams.put(VirtualMachineProfile.Param.ReturnAfterVolumePrepare, true);
 
         try {
-            vm = startVirtualMachine(vmId, null, null, null, diskOfferingMap, 
additonalParams, null);
-
-            boolean status =  
stopVirtualMachine(CallContext.current().getCallingUserId(), vm.getId()) ;

Review Comment:
   stopVirtualMachine call has been removed. cleanup code was to handle any 
errors returned from that. if startVirtualMachine() fails, it should return an 
exception for which cleanup is done in the catch block.
   
   thinking about it more, we should catch all the exceptions thrown by 
startVirtualMachie. Currently the code only catches CloudRuntimeException.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to