cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [1/4] git commit: updated refs/heads/object_store to 252f384
Date Tue, 14 May 2013 21:57:42 GMT
Updated Branches:
  refs/heads/object_store 12583bbff -> 252f384e8


Only download eligible system template for S3 image store.


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

Branch: refs/heads/object_store
Commit: 87af4ddab06327787d77f1eab3bdc9939a523e30
Parents: 12583bb
Author: Min Chen <min.chen@citrix.com>
Authored: Tue May 14 14:45:35 2013 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Tue May 14 14:57:01 2013 -0700

----------------------------------------------------------------------
 .../storage/image/TemplateServiceImpl.java         |   24 ++++++++++++--
 1 files changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/87af4dda/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 a9302b3..9bd7cb7 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
@@ -185,11 +185,27 @@ public class TemplateServiceImpl implements TemplateService {
             toBeDownloaded.add(rtngTmplt);
         }
 
+        List<HypervisorType> availHypers = _clusterDao.getAvailableHypervisorInZone(store.getScope().getScopeId());
+        if (availHypers.isEmpty()) {
+            /*
+             * This is for cloudzone, local secondary storage resource
+             * started before cluster created
+             */
+            availHypers.add(HypervisorType.KVM);
+        }
+        /* Baremetal need not to download any template */
+        availHypers.remove(HypervisorType.BareMetal);
+        availHypers.add(HypervisorType.None); // bug 9809: resume ISO
+                                              // download.
+
         for (VMTemplateVO template : toBeDownloaded) {
-            TemplateDataStoreVO tmpltHost = _vmTemplateStoreDao.findByStoreTemplate(store.getId(),
template.getId());
-            if (tmpltHost == null || tmpltHost.getState() != ObjectInDataStoreStateMachine.State.Ready)
{
-            	TemplateInfo tmplt = _templateFactory.getTemplate(template.getId(), DataStoreRole.Image);
-                createTemplateAsync(tmplt, store, null);
+            if (availHypers.contains(template.getHypervisorType())) {
+                // only download sys template applicable for current hypervisor
+                TemplateDataStoreVO tmpltHost = _vmTemplateStoreDao.findByStoreTemplate(store.getId(),
template.getId());
+                if (tmpltHost == null || tmpltHost.getState() != ObjectInDataStoreStateMachine.State.Ready)
{
+                    TemplateInfo tmplt = _templateFactory.getTemplate(template.getId(), DataStoreRole.Image);
+                    createTemplateAsync(tmplt, store, null);
+                }
             }
         }
     }


Mime
View raw message