CLOUDSTACK-7754: Templates source_template_id is null when it is created from Snapshot with its corresponding volume removed. Fix it by searching for volumes including removed.

This commit is contained in:
Nitin Mehta 2014-10-20 16:49:48 -07:00
parent e796d418b4
commit 287ff83552
1 changed files with 3 additions and 2 deletions

View File

@ -1413,9 +1413,10 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
privateTemplate = _tmpltDao.findById(templateId);
if (snapshotId != null) {
//getting the prent volume
//getting the parent volume
long parentVolumeId = _snapshotDao.findById(snapshotId).getVolumeId();
VolumeVO parentVolume = _volumeDao.findById(parentVolumeId);
//Volume can be removed
VolumeVO parentVolume = _volumeDao.findByIdIncludingRemoved(parentVolumeId);
if (parentVolume != null && parentVolume.getIsoId() != null && parentVolume.getIsoId() != 0) {
privateTemplate.setSourceTemplateId(parentVolume.getIsoId());