GutoVeronezi opened a new pull request #4698: URL: https://github.com/apache/cloudstack/pull/4698
### Description In the execution flow of the API `migrateVirtualMachineWithVolume`, there is a step that copies the volume's template to the target storage, if it is needed. In some cases when the volume is a `data` type, it (the volume) does not have a template; therefore, it is going to generate an NPE when it tries to get the template's ID (Long to long auto conversion). This PR intends to validate if the volume being copied has a template, before trying to copy the template. ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [ ] Bug fix (non-breaking change which fixes an issue) - [x] 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 ### How Has This Been Tested? It has been tested locally in a test lab. 1. I had created a VM and attached 2 volumes to it. 2. I had migrated the VM to another `host` and the volumes to different `storage` to see if it migrates accordingly. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
