cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anim...@apache.org
Subject git commit: updated refs/heads/4.2 to e39a7d8
Date Wed, 04 Sep 2013 00:22:41 GMT
Updated Branches:
  refs/heads/4.2 6756df0c2 -> e39a7d8e0


CLOUDSTACK-4600:Registered Cross-zone template does not populate
template_zone_ref for later added zones.(cherry picked from commit 3dc8b8863a02772e92bb10376d3ee5e4382c0944)

Signed-off-by: animesh <animesh@apache.org>


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

Branch: refs/heads/4.2
Commit: e39a7d8e0d3f2fd3e326b1bdf4aaf9ba5d900b02
Parents: 6756df0
Author: Min Chen <min.chen@citrix.com>
Authored: Tue Sep 3 16:31:40 2013 -0700
Committer: animesh <animesh@apache.org>
Committed: Tue Sep 3 17:21:39 2013 -0700

----------------------------------------------------------------------
 .../subsystem/api/storage/TemplateService.java     |  2 ++
 .../storage/image/TemplateServiceImpl.java         | 17 +++++++++++++++++
 .../cloud/storage/download/DownloadListener.java   |  2 ++
 3 files changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e39a7d8e/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateService.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateService.java
b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateService.java
index 085fbbd..4950597 100644
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateService.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateService.java
@@ -61,4 +61,6 @@ public interface TemplateService {
     void downloadBootstrapSysTemplate(DataStore store);
 
     void addSystemVMTemplatesToSecondary(DataStore store);
+    
+    void associateCrosszoneTemplatesToZone(long dcId);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e39a7d8e/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
index a77270f..0113bc0 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
@@ -487,6 +487,23 @@ public class TemplateServiceImpl implements TemplateService {
         }
     }
 
+    // update template_zone_ref for cross-zone template for newly added zone
+    @Override
+    public void associateCrosszoneTemplatesToZone(long dcId){
+        VMTemplateZoneVO tmpltZone;
+
+        List<VMTemplateVO> allTemplates = _templateDao.listAll();
+        for (VMTemplateVO vt: allTemplates){
+            if (vt.isCrossZones()) {
+                tmpltZone = _vmTemplateZoneDao.findByZoneTemplate(dcId, vt.getId());
+                if (tmpltZone == null) {
+                    VMTemplateZoneVO vmTemplateZone = new VMTemplateZoneVO(dcId, vt.getId(),
new Date());
+                    _vmTemplateZoneDao.persist(vmTemplateZone);
+                }
+            }
+        }
+    }
+    
     private Map<String, TemplateProp> listTemplate(DataStore ssStore) {
         ListTemplateCommand cmd = new ListTemplateCommand(ssStore.getTO());
         EndPoint ep = _epSelector.select(ssStore);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e39a7d8e/server/src/com/cloud/storage/download/DownloadListener.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/download/DownloadListener.java b/server/src/com/cloud/storage/download/DownloadListener.java
index 3b6c0dd..e5efcb2 100755
--- a/server/src/com/cloud/storage/download/DownloadListener.java
+++ b/server/src/com/cloud/storage/download/DownloadListener.java
@@ -289,6 +289,8 @@ public class DownloadListener implements Listener {
 	            return;
 	        }
 	        _imageSrv.handleSysTemplateDownload(hostHyper, agent.getDataCenterId());
+	        // update template_zone_ref for cross-zone templates
+	        _imageSrv.associateCrosszoneTemplatesToZone(agent.getDataCenterId());
 	    }
 	    /* This can be removed
 	    else if ( cmd instanceof StartupStorageCommand) {


Mime
View raw message