cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject git commit: updated refs/heads/4.2-forward to 9bff36e
Date Wed, 18 Sep 2013 00:04:19 GMT
Updated Branches:
  refs/heads/4.2-forward 066d944c7 -> 9bff36ef4


add sourcetemplateid for template created from volume/snapshot


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

Branch: refs/heads/4.2-forward
Commit: 9bff36ef45bdb894ce2c4218456af868791f4a63
Parents: 066d944
Author: Edison Su <sudison@gmail.com>
Authored: Tue Sep 17 17:03:42 2013 -0700
Committer: Edison Su <sudison@gmail.com>
Committed: Tue Sep 17 17:04:03 2013 -0700

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9bff36ef/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 fa92a02..f511da2 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -1403,16 +1403,22 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
                     //getting the prent volume
                     long parentVolumeId=_snapshotDao.findById(snapshotId).getVolumeId();
                     VolumeVO parentVolume = _volumeDao.findById(parentVolumeId);
-                    if (parentVolume != null && parentVolume.getIsoId() != null)
{
+                    if (parentVolume != null && parentVolume.getIsoId() != null &&
parentVolume.getIsoId() != 0) {
                         privateTemplate.setSourceTemplateId(parentVolume.getIsoId());
                         _tmpltDao.update(privateTemplate.getId(), privateTemplate);
+                    } else if (parentVolume != null && parentVolume.getTemplateId()
!= null) {
+                        privateTemplate.setSourceTemplateId(parentVolume.getTemplateId());
+                        _tmpltDao.update(privateTemplate.getId(), privateTemplate);
                     }
                 }
                 else if (volumeId != null) {
                     VolumeVO parentVolume = _volumeDao.findById(volumeId);
-                    if (parentVolume.getIsoId() != null) {
+                    if (parentVolume.getIsoId() != null && parentVolume.getIsoId()
!= 0) {
                         privateTemplate.setSourceTemplateId(parentVolume.getIsoId());
                         _tmpltDao.update(privateTemplate.getId(), privateTemplate);
+                    } else if (parentVolume.getTemplateId() != null) {
+                        privateTemplate.setSourceTemplateId(parentVolume.getTemplateId());
+                        _tmpltDao.update(privateTemplate.getId(), privateTemplate);
                     }
                 }
                 TemplateDataStoreVO srcTmpltStore = this._tmplStoreDao.findByStoreTemplate(store.getId(),
templateId);


Mime
View raw message