abh1sar commented on code in PR #11560:
URL: https://github.com/apache/cloudstack/pull/11560#discussion_r2330542441
##########
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:
This cleanup was for error returned from stopVirtualMachine.
startVirtualMachine should throw an exception if it fails, for which cleanup
is done in the catch block.
thinking about it more, startVirtualMachine returns some more Exception
types apart from CloudRuntimeException, which is not being caught here. I'll
add those.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]