You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/03/08 12:43:24 UTC

[GitHub] [cloudstack] harikrishna-patnala commented on a change in pull request #4771: migrateVMWithVolume: Handle migrate vm with volume where data disk is not based off a template

harikrishna-patnala commented on a change in pull request #4771:
URL: https://github.com/apache/cloudstack/pull/4771#discussion_r589393500



##########
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:
       @Pearl1594 can you help me understanding on which object we are getting NPE. I'm seeing only srcVolumeInfo as possible object but it would have failed earlier at 198 Line.




----------------------------------------------------------------
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:
users@infra.apache.org