gpordeus opened a new pull request, #7615: URL: https://github.com/apache/cloudstack/pull/7615
### Description If you try to migrate a VM with volume and its template was removed, it results in a NullPointerException and the migration doesn't occur. If the template is already in both pools, the NPE happens in `getVolumeBackingFile`, when `_vmTemplateDao.findById()` returns null and it then tries to call from it. The fix was to check if it is null (and since it can only be null if it was removed, since `srcVolumeInfo` has `templateId`) and return null so it does a FullClone Migration. If the template is not in both pools, the NPE happens in `copyTemplateToTargetFilesystemStorageIfNeeded`, when `TemplateObjectTO` tries to `getInstallPath()` on a null object. The fix was the same, check if `findById()` returns null and, if so, don't copy it. ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [X] Bug fix (non-breaking change which fixes an issue) - [ ] Enhancement (improves an existing feature and functionality) - [ ] Cleanup (Code refactoring and cleanup, that may add test cases) ### Feature/Enhancement Scale or Bug Severity #### Feature/Enhancement Scale - [ ] Major - [X] Minor #### Bug Severity - [ ] BLOCKER - [ ] Critical - [ ] Major - [X] Minor - [ ] Trivial ### Screenshots (if appropriate): ### How Has This Been Tested? - Uploaded two templates (A and B) to ACS, created one VM for each. Deleted B. - Called migrateVirtualMachineWithVolume to migrate VM A on both host and storage pool. - Called migrateVirtualMachineWithVolume to migrate VM B on both host and storage pool. - Deleted A. - Called migrateVirtualMachineWithVolume to migrate VM A, again. All migrations were successful. -- 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]
