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 13:22:30 UTC

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

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



##########
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:
       @harikrishna-patnala I've updated the exception,  you're right, the exception happens at line198 - I had added a few debug lines which was why it showed the exception occuring at L200




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