GutoVeronezi commented on a change in pull request #4771:
URL: https://github.com/apache/cloudstack/pull/4771#discussion_r589447271



##########
File path: 
engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/KvmNonManagedStorageDataMotionStrategy.java
##########
@@ -195,7 +195,10 @@ protected boolean shouldMigrateVolume(StoragePoolVO 
sourceStoragePool, Host dest
     @Override
     protected void copyTemplateToTargetFilesystemStorageIfNeeded(VolumeInfo 
srcVolumeInfo, StoragePool srcStoragePool, DataStore destDataStore, StoragePool 
destStoragePool,
             Host destHost) {
-        VMTemplateStoragePoolVO sourceVolumeTemplateStoragePoolVO = 
vmTemplatePoolDao.findByPoolTemplate(destStoragePool.getId(), 
srcVolumeInfo.getTemplateId(), null);
+        VMTemplateStoragePoolVO sourceVolumeTemplateStoragePoolVO = null;
+        if (srcVolumeInfo != null && srcVolumeInfo.getTemplateId() != null) {
+            sourceVolumeTemplateStoragePoolVO = 
vmTemplatePoolDao.findByPoolTemplate(destStoragePool.getId(), 
srcVolumeInfo.getTemplateId(), null);
+        }
         if (sourceVolumeTemplateStoragePoolVO == null && 
destStoragePool.getPoolType() == StoragePoolType.Filesystem) {
             DataStore sourceTemplateDataStore = 
dataStoreManagerImpl.getRandomImageStore(srcVolumeInfo.getDataCenterId());

Review comment:
       @GabrielBrascher It will. I mention it to explain why it is happening.




----------------------------------------------------------------
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]


Reply via email to