abh1sar commented on code in PR #11560: URL: https://github.com/apache/cloudstack/pull/11560#discussion_r2320770191
########## server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java: ########## @@ -1310,18 +1331,21 @@ public boolean restoreBackupToVM(final Long backupId, final Long vmId) throws Re host = restoreInfo.first().getPrivateIpAddress(); dataStore = restoreInfo.second().getUuid(); } - if (!backupProvider.restoreBackupToVM(vm, backup, host, dataStore)) { - throw new CloudRuntimeException(String.format("Error restoring backup [%s] to VM %s.", backupDetailsInMessage, vm.getUuid())); - } + result = backupProvider.restoreBackupToVM(vm, backup, host, dataStore); + } catch (Exception e) { - updateVolumeState(vm, Volume.Event.RestoreFailed, Volume.State.Ready); - updateVmState(vm, VirtualMachine.Event.RestoringFailed, VirtualMachine.State.Stopped); - logger.error(String.format("Failed to create Instance [%s] from backup [%s] due to: [%s].", vm.getInstanceName(), backupDetailsInMessage, e.getMessage()), e); - ActionEventUtils.onCompletedActionEvent(User.UID_SYSTEM, vm.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_CREATE_FROM_BACKUP, - String.format("Failed to create Instance %s from backup %s", vm.getInstanceName(), backup.getUuid()), - vm.getId(), ApiCommandResourceType.VirtualMachine.toString(), eventId); + logger.error(String.format("Failed to create Instance [%s] from backup [%s] due to: [%s]", vm.getInstanceName(), backupDetailsInMessage, e.getMessage()), e); + processRestoreBackupToVMFailure(vm, backup, eventId); throw new CloudRuntimeException(String.format("Error while creating Instance [%s] from backup [%s].", vm.getUuid(), backupDetailsInMessage)); } + + if (result != null && !result.first()) { + String error_msg = String.format("Failed to create Instance [%s] from backup [%s] due to: %s.", vm.getInstanceName(), backupDetailsInMessage, result.second()); + logger.error(error_msg); + processRestoreBackupToVMFailure(vm, backup, eventId); + throw new CloudRuntimeException(error_msg); Review Comment: fiy - this is done to pass on the error passed by the provider. -- 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