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/4.2 to 9f03150
Date Fri, 10 Jan 2014 00:24:48 GMT
Updated Branches:
  refs/heads/4.2 3af4cf448 -> 9f03150a4


CLOUDSTACK-5653:S3 object store as Secondary Storage, the template
created from different zone is not available for the other zones.

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

Branch: refs/heads/4.2
Commit: 9f03150a4ff4269ef992b8271c2e30eb23802e8f
Parents: 3af4cf4
Author: Min Chen <min.chen@citrix.com>
Authored: Thu Jan 9 16:12:16 2014 -0800
Committer: Min Chen <min.chen@citrix.com>
Committed: Thu Jan 9 16:12:16 2014 -0800

----------------------------------------------------------------------
 .../engine/subsystem/api/storage/DataStoreManager.java  |  2 ++
 .../engine/subsystem/api/storage/TemplateService.java   |  2 ++
 .../cloudstack/storage/image/TemplateServiceImpl.java   |  3 ++-
 .../storage/datastore/DataStoreManagerImpl.java         |  9 +++++++++
 server/src/com/cloud/template/TemplateManagerImpl.java  | 12 +++++++++---
 5 files changed, 24 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f03150a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreManager.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreManager.java
b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreManager.java
index 0884453..febce40 100644
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreManager.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreManager.java
@@ -37,4 +37,6 @@ public interface DataStoreManager {
     DataStore getImageCacheStore(long zoneId);
 
     List<DataStore> listImageStores();
+    
+    boolean isRegionStore(DataStore store);    
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f03150a/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 4950597..72c3374 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
@@ -62,5 +62,7 @@ public interface TemplateService {
 
     void addSystemVMTemplatesToSecondary(DataStore store);
     
+    void associateTemplateToZone(long templateId, Long zoneId);    
+    
     void associateCrosszoneTemplatesToZone(long dcId);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f03150a/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 0113bc0..07cd59f 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
@@ -465,7 +465,8 @@ public class TemplateServiceImpl implements TemplateService {
     // persist entry in template_zone_ref table. zoneId can be empty for
     // region-wide image store, in that case,
     // we will associate the template to all the zones.
-    private void associateTemplateToZone(long templateId, Long zoneId) {
+    @Override
+    public void associateTemplateToZone(long templateId, Long zoneId) {
         List<Long> dcs = new ArrayList<Long>();
         if (zoneId != null) {
             dcs.add(zoneId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f03150a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java
b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java
index 00d08d7..4bb8e54 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java
@@ -19,6 +19,7 @@
 package org.apache.cloudstack.storage.datastore;
 
 import com.cloud.storage.DataStoreRole;
+import com.cloud.storage.ScopeType;
 import com.cloud.utils.exception.CloudRuntimeException;
 import edu.emory.mathcs.backport.java.util.Collections;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
@@ -80,6 +81,14 @@ public class DataStoreManagerImpl implements DataStoreManager {
     }
 
     @Override
+    public boolean isRegionStore(DataStore store) {
+        if (store.getScope().getScopeType() == ScopeType.ZONE && store.getScope().getScopeId()
== null)
+            return true;
+        else
+            return false;
+    }
+    
+    @Override
     public DataStore getPrimaryDataStore(long storeId) {
         return primaryStoreMgr.getPrimaryDataStore(storeId);
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f03150a/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 3a05882..396ae61 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -1400,9 +1400,15 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
                     throw new CloudRuntimeException("Failed to create template" + result.getResult());
                 }
 
-                VMTemplateZoneVO templateZone = new VMTemplateZoneVO(zoneId, templateId,
new Date());
-                this._tmpltZoneDao.persist(templateZone);
-
+                // create entries in template_zone_ref table
+                if (_dataStoreMgr.isRegionStore(store)) {
+                    // template created on region store
+                    _tmpltSvr.associateTemplateToZone(templateId, null);
+                } else {
+                    VMTemplateZoneVO templateZone = new VMTemplateZoneVO(zoneId, templateId,
new Date());
+                    _tmpltZoneDao.persist(templateZone);
+                }
+                
                 privateTemplate = this._tmpltDao.findById(templateId);
                 if (snapshotId != null) {
                     //getting the prent volume


Mime
View raw message