cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prachida...@apache.org
Subject [03/50] [abbrv] git commit: updated refs/heads/planner_reserve to 9b86516
Date Sun, 05 May 2013 07:59:28 GMT
CLOUDSTACK-2120: API - mixed zone management - fix a bug that listTemplates/listIsos API didn't
take in zoneType properly.


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

Branch: refs/heads/planner_reserve
Commit: 3d10f700f97d0daee7e6d69e4436c7955bc7e13a
Parents: 50a3c91
Author: Jessica Wang <jessicawang@apache.org>
Authored: Wed May 1 16:13:20 2013 -0700
Committer: Jessica Wang <jessicawang@apache.org>
Committed: Wed May 1 16:13:20 2013 -0700

----------------------------------------------------------------------
 .../com/cloud/storage/dao/VMTemplateDaoImpl.java   |   19 ++++++++++----
 1 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d10f700/server/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/dao/VMTemplateDaoImpl.java b/server/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
index 7101071..25ae933 100755
--- a/server/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
+++ b/server/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
@@ -562,10 +562,15 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO,
Long> implem
         		sql = SELECT_TEMPLATE_HOST_REF;
                 groupByClause = " GROUP BY t.id, h.data_center_id ";
         	}
-        	if (((templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.community))
||(zoneType != null && zoneId != null)) {
+        	if ((templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.community))
{
         	    dataCenterJoin = " INNER JOIN data_center dc on (h.data_center_id = dc.id)";
         	}
-
+        	
+        	if (zoneType != null) {
+        	    dataCenterJoin = " INNER JOIN template_host_ref thr on (t.id = thr.template_id)
INNER JOIN host h on (thr.host_id = h.id)";
+                dataCenterJoin += " INNER JOIN data_center dc on (h.data_center_id = dc.id)";
+            }
+        	
         	if (templateFilter == TemplateFilter.sharedexecutable || templateFilter == TemplateFilter.shared
){
         	    lpjoin = " INNER JOIN launch_permission lp ON t.id = lp.template_id ";
         	}
@@ -783,13 +788,15 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO,
Long> implem
         		sql += " AND h.data_center_id = " +zoneId;
             }
         }else if (zoneId != null){
-        	sql += " AND tzr.zone_id = " +zoneId+ " AND tzr.removed is null" ;
-        	if (zoneType != null){        	  
-        		sql += " AND dc.networktype = " + zoneType;
-        	}        	
+        	sql += " AND tzr.zone_id = " +zoneId+ " AND tzr.removed is null" ;        	    
	
         }else{
         	sql += " AND tzr.removed is null ";
         }
+        
+        if (zoneType != null){            
+            sql += " AND dc.networktype = '" + zoneType + "'";
+        }   
+        
         if (!showDomr){
         	sql += " AND t.type != '" +Storage.TemplateType.SYSTEM.toString() + "'";
         }


Mime
View raw message