Skip to content

Commit 287ff83

Browse files
committed
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.
1 parent e796d41 commit 287ff83

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

server/src/com/cloud/template/TemplateManagerImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,9 +1413,10 @@ public VirtualMachineTemplate createPrivateTemplate(CreateTemplateCmd command) t
14131413

14141414
privateTemplate = _tmpltDao.findById(templateId);
14151415
if (snapshotId != null) {
1416-
//getting the prent volume
1416+
//getting the parent volume
14171417
long parentVolumeId = _snapshotDao.findById(snapshotId).getVolumeId();
1418-
VolumeVO parentVolume = _volumeDao.findById(parentVolumeId);
1418+
//Volume can be removed
1419+
VolumeVO parentVolume = _volumeDao.findByIdIncludingRemoved(parentVolumeId);
14191420

14201421
if (parentVolume != null && parentVolume.getIsoId() != null && parentVolume.getIsoId() != 0) {
14211422
privateTemplate.setSourceTemplateId(parentVolume.getIsoId());

0 commit comments

Comments
 (0)