cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jessicaw...@apache.org
Subject [5/8] git commit: updated refs/heads/master-6-17-stable to d9ca0e8
Date Tue, 18 Jun 2013 18:51:10 GMT
CLOUDSTACK-3016: remove zonetype parameter from listTemplates, listIsos API.


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

Branch: refs/heads/master-6-17-stable
Commit: 82270f12f2c8cd2c43c2a9161a0ee51162462aaf
Parents: fc26315
Author: Jessica Wang <jessicawang@apache.org>
Authored: Mon Jun 17 16:08:38 2013 -0700
Committer: Jessica Wang <jessicawang@apache.org>
Committed: Tue Jun 18 11:36:57 2013 -0700

----------------------------------------------------------------------
 .../api/command/user/iso/ListIsosCmd.java       |  7 -------
 .../command/user/template/ListTemplatesCmd.java |  8 --------
 .../com/cloud/storage/dao/VMTemplateDao.java    |  2 +-
 .../cloud/storage/dao/VMTemplateDaoImpl.java    | 21 ++++++--------------
 .../com/cloud/server/ManagementServerImpl.java  | 12 +++++------
 5 files changed, 13 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/82270f12/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
index f872c12..3219601 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
@@ -78,9 +78,6 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
             description="the ID of the zone")
     private Long zoneId;
 
-    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network
type of the zone that the virtual machine belongs to")
-    private String zoneType;
-    
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -118,10 +115,6 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
         return zoneId;
     }
 
-    public String getZoneType() {
-        return zoneType;
-    }
-    
     public boolean listInReadyState() {
         Account account = UserContext.current().getCaller();
         // It is account specific if account is admin type and domainId and accountName are
not null

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/82270f12/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
index f0fc241..aeb76f5 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
@@ -68,10 +68,6 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
     @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
             description="list templates by zoneId")
     private Long zoneId;
-    
-    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network
type of the zone that the virtual machine belongs to")
-    private String zoneType;
-    
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -96,10 +92,6 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
         return zoneId;
     }
 
-    public String getZoneType() {
-        return zoneType;
-    }
-    
     public boolean listInReadyState() {
 
         Account account = UserContext.current().getCaller();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/82270f12/engine/schema/src/com/cloud/storage/dao/VMTemplateDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/VMTemplateDao.java b/engine/schema/src/com/cloud/storage/dao/VMTemplateDao.java
index 8520757..7c66dd4 100755
--- a/engine/schema/src/com/cloud/storage/dao/VMTemplateDao.java
+++ b/engine/schema/src/com/cloud/storage/dao/VMTemplateDao.java
@@ -56,7 +56,7 @@ public interface VMTemplateDao extends GenericDao<VMTemplateVO, Long>,
StateDao<
 	public Set<Pair<Long, Long>> searchTemplates(String name, String keyword, TemplateFilter
templateFilter, boolean isIso,
 	        List<HypervisorType> hypers, Boolean bootable, DomainVO domain, Long pageSize,
Long startIndex, Long zoneId,
 	        HypervisorType hyperType, boolean onlyReady, boolean showDomr, List<Account>
permittedAccounts, Account caller,
-	        ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String>
tags, String zoneType);
+	        ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String>
tags);
 	
     public Set<Pair<Long, Long>> searchSwiftTemplates(String name, String keyword,
TemplateFilter templateFilter,
             boolean isIso, List<HypervisorType> hypers, Boolean bootable, DomainVO
domain, Long pageSize, Long startIndex,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/82270f12/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
index 25ae933..d45ef73 100755
--- a/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
+++ b/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
@@ -521,7 +521,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO,
Long> implem
 	public Set<Pair<Long, Long>> searchTemplates(String name, String keyword, TemplateFilter
templateFilter,
 	        boolean isIso, List<HypervisorType> hypers, Boolean bootable, DomainVO domain,
Long pageSize, Long startIndex,
 	        Long zoneId, HypervisorType hyperType, boolean onlyReady, boolean showDomr,List<Account>
permittedAccounts,
-	        Account caller, ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String,
String> tags, String zoneType) {
+	        Account caller, ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String,
String> tags) {
         StringBuilder builder = new StringBuilder();
         if (!permittedAccounts.isEmpty()) {
             for (Account permittedAccount : permittedAccounts) {
@@ -565,12 +565,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO,
Long> implem
         	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 ";
         	}
@@ -697,7 +692,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO,
Long> implem
             }
 
             sql += whereClause + getExtrasWhere(templateFilter, name, keyword, isIso, bootable,
hyperType, zoneId,
-                    onlyReady, showDomr, zoneType) + groupByClause + getOrderByLimit(pageSize,
startIndex);
+                    onlyReady, showDomr) + groupByClause + getOrderByLimit(pageSize, startIndex);
 
             pstmt = txn.prepareStatement(sql);
             rs = pstmt.executeQuery();
@@ -758,7 +753,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO,
Long> implem
         return templateZonePairList;
 	}
 
-	private String getExtrasWhere(TemplateFilter templateFilter, String name, String keyword,
boolean isIso, Boolean bootable, HypervisorType hyperType, Long zoneId, boolean onlyReady,
boolean showDomr, String zoneType) {
+	private String getExtrasWhere(TemplateFilter templateFilter, String name, String keyword,
boolean isIso, Boolean bootable, HypervisorType hyperType, Long zoneId, boolean onlyReady,
boolean showDomr) {
 	    String sql = "";
         if (keyword != null) {
             sql += " t.name LIKE \"%" + keyword + "%\" AND";
@@ -788,15 +783,11 @@ 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" ;        	    
	
+        	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() + "'";
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/82270f12/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 5a332b4..dea761d 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -1719,7 +1719,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
         HypervisorType hypervisorType = HypervisorType.getType(cmd.getHypervisor());
         return listTemplates(cmd.getId(), cmd.getIsoName(), cmd.getKeyword(), isoFilter,
true, cmd.isBootable(), cmd.getPageSizeVal(),
                 cmd.getStartIndex(), cmd.getZoneId(), hypervisorType, true, cmd.listInReadyState(),
permittedAccounts, caller,
-                listProjectResourcesCriteria, tags, cmd.getZoneType());
+                listProjectResourcesCriteria, tags);
     }
 
     @Override
@@ -1752,12 +1752,12 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
         HypervisorType hypervisorType = HypervisorType.getType(cmd.getHypervisor());
 
         return listTemplates(id, cmd.getTemplateName(), cmd.getKeyword(), templateFilter,
false, null, cmd.getPageSizeVal(), cmd.getStartIndex(),
-                cmd.getZoneId(), hypervisorType, showDomr, cmd.listInReadyState(), permittedAccounts,
caller, listProjectResourcesCriteria, tags, cmd.getZoneType());
+                cmd.getZoneId(), hypervisorType, showDomr, cmd.listInReadyState(), permittedAccounts,
caller, listProjectResourcesCriteria, tags);
     }
 
     private Set<Pair<Long, Long>> listTemplates(Long templateId, String name,
String keyword, TemplateFilter templateFilter, boolean isIso,
             Boolean bootable, Long pageSize, Long startIndex, Long zoneId, HypervisorType
hyperType, boolean showDomr, boolean onlyReady,
-            List<Account> permittedAccounts, Account caller, ListProjectResourcesCriteria
listProjectResourcesCriteria, Map<String, String> tags, String zoneType) {
+            List<Account> permittedAccounts, Account caller, ListProjectResourcesCriteria
listProjectResourcesCriteria, Map<String, String> tags) {
 
         VMTemplateVO template = null;
         if (templateId != null) {
@@ -1798,7 +1798,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
                         startIndex, zoneId, hyperType, onlyReady, showDomr, permittedAccounts,
caller, tags);
                 Set<Pair<Long, Long>> templateZonePairSet2 = new HashSet<Pair<Long,
Long>>();
                 templateZonePairSet2 = _templateDao.searchTemplates(name, keyword, templateFilter,
isIso, hypers, bootable, domain, pageSize,
-                        startIndex, zoneId, hyperType, onlyReady, showDomr, permittedAccounts,
caller, listProjectResourcesCriteria, tags, zoneType);
+                        startIndex, zoneId, hyperType, onlyReady, showDomr, permittedAccounts,
caller, listProjectResourcesCriteria, tags);
 
                 for (Pair<Long, Long> tmpltPair : templateZonePairSet2) {
                     if (!templateZonePairSet.contains(new Pair<Long, Long>(tmpltPair.first(),
-1L))) {
@@ -1822,7 +1822,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
                 Set<Pair<Long, Long>> templateZonePairSet2 = new HashSet<Pair<Long,
Long>>();
                 templateZonePairSet2 = _templateDao.searchTemplates(name, keyword, templateFilter,
isIso, hypers,
                         bootable, domain, pageSize, startIndex, zoneId, hyperType, onlyReady,
showDomr,
-                        permittedAccounts, caller, listProjectResourcesCriteria, tags, zoneType);
+                        permittedAccounts, caller, listProjectResourcesCriteria, tags);
 
                 for (Pair<Long, Long> tmpltPair : templateZonePairSet2) {
                     if (!templateZonePairSet.contains(new Pair<Long, Long>(tmpltPair.first(),
-1L))) {
@@ -1840,7 +1840,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
         } else {
             if (template == null) {
                 templateZonePairSet = _templateDao.searchTemplates(name, keyword, templateFilter,
isIso, hypers, bootable, domain, pageSize,
-                        startIndex, zoneId, hyperType, onlyReady, showDomr, permittedAccounts,
caller, listProjectResourcesCriteria, tags, zoneType);
+                        startIndex, zoneId, hyperType, onlyReady, showDomr, permittedAccounts,
caller, listProjectResourcesCriteria, tags);
             } else {
                 // if template is not public, perform permission check here
                 if (!template.isPublicTemplate() && caller.getType() != Account.ACCOUNT_TYPE_ADMIN)
{


Mime
View raw message