cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [28/34] git commit: updated refs/heads/ui-restyle to 23093ed
Date Thu, 26 Sep 2013 18:03:29 GMT
add sourcetemplateid for template created from volume/snapshot

Conflicts:

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


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

Branch: refs/heads/ui-restyle
Commit: a9aad4f3887e91061b569e9aebd75d0d6a16073e
Parents: 9baa453
Author: Edison Su <sudison@gmail.com>
Authored: Wed Sep 25 16:35:31 2013 -0700
Committer: Edison Su <sudison@gmail.com>
Committed: Wed Sep 25 16:35:31 2013 -0700

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a9aad4f3/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 c52c323..9fa2e8b 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -1389,16 +1389,23 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
                     //getting the prent volume
                     long parentVolumeId=_snapshotDao.findById(snapshotId).getVolumeId();
                     VolumeVO parentVolume = _volumeDao.findById(parentVolumeId);
-                    if (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 = _tmplStoreDao.findByStoreTemplate(store.getId(),
templateId);


Mime
View raw message