cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject git commit: updated refs/heads/master to e92d46b
Date Tue, 03 Sep 2013 23:47:43 GMT
Updated Branches:
  refs/heads/master bf967eb62 -> e92d46bfd


CLOUDSTACK-4600:Registered Cross-zone template does not populate
template_zone_ref for later added zones.


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

Branch: refs/heads/master
Commit: e92d46bfd43a6cffac66e1b6be4c8c25d10b0ab1
Parents: bf967eb
Author: Min Chen <min.chen@citrix.com>
Authored: Tue Sep 3 16:31:40 2013 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Tue Sep 3 16:39:23 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/e92d46bf/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/e92d46bf/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 ab1f286..a68e40c 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
@@ -488,6 +488,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/e92d46bf/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