Repository: cloudstack
Updated Branches:
  refs/heads/4.5 e796d418b -> 287ff8355


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.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/287ff835
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/287ff835
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/287ff835

Branch: refs/heads/4.5
Commit: 287ff83552081cd91c68af6214016ca4cc4cc040
Parents: e796d41
Author: Nitin Mehta <nitin.me...@citrix.com>
Authored: Mon Oct 20 16:49:48 2014 -0700
Committer: Nitin Mehta <nitin.me...@citrix.com>
Committed: Mon Oct 20 16:49:48 2014 -0700

----------------------------------------------------------------------
 server/src/com/cloud/template/TemplateManagerImpl.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/287ff835/server/src/com/cloud/template/TemplateManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java 
b/server/src/com/cloud/template/TemplateManagerImpl.java
index 247ed00..c7d2283 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -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());

Reply via email to