You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by we...@apache.org on 2013/06/18 09:58:37 UTC

[37/50] [abbrv] git commit: updated refs/heads/disk_io_throttling to 691bc9d

CLOUDSTACK-3016: remove zonetype parameter from listPods API.


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

Branch: refs/heads/disk_io_throttling
Commit: 56d390d54e07aff4aebf85960a89dd2d68f9143f
Parents: 9d0d022
Author: Jessica Wang <je...@apache.org>
Authored: Mon Jun 17 15:51:07 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Mon Jun 17 15:51:07 2013 -0700

----------------------------------------------------------------------
 .../api/command/admin/pod/ListPodsByCmd.java    |  7 -----
 .../com/cloud/server/ManagementServerImpl.java  | 32 +++++---------------
 2 files changed, 8 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/56d390d5/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
index db233ae..3dace42 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
@@ -55,9 +55,6 @@ public class ListPodsByCmd extends BaseListCmd {
     @Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="list pods by allocation state")
     private String allocationState;
 
-    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
-    private String zoneType;
-    
     @Parameter(name=ApiConstants.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the pods")
     private Boolean showCapacities;
 
@@ -81,10 +78,6 @@ public class ListPodsByCmd extends BaseListCmd {
         return allocationState;
     }
 
-    public String getZoneType() {
-        return zoneType;
-    }
-    
     public Boolean getShowCapacities() {
         return showCapacities;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/56d390d5/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 f09aa21..2099d2f 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -1448,29 +1448,17 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
 
     @Override
     public Pair<List<? extends Pod>, Integer> searchForPods(ListPodsByCmd cmd) {
+        Filter searchFilter = new Filter(HostPodVO.class, "dataCenterId", true, cmd.getStartIndex(), cmd.getPageSizeVal());
+        SearchCriteria<HostPodVO> sc = _hostPodDao.createSearchCriteria();
+
         String podName = cmd.getPodName();
         Long id = cmd.getId();
         Long zoneId = cmd.getZoneId();
         Object keyword = cmd.getKeyword();
         Object allocationState = cmd.getAllocationState();
-        String zoneType = cmd.getZoneType();
-        zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), zoneId);
-
-
-    	Filter searchFilter = new Filter(HostPodVO.class, "dataCenterId", true, cmd.getStartIndex(), cmd.getPageSizeVal());
-        SearchBuilder<HostPodVO> sb = _hostPodDao.createSearchBuilder();
-        sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
-        sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
-        sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
-        sb.and("allocationState", sb.entity().getAllocationState(), SearchCriteria.Op.EQ);
 
-        if(zoneType != null) {
-            SearchBuilder<DataCenterVO> zoneSb = _dcDao.createSearchBuilder();
-            zoneSb.and("zoneNetworkType", zoneSb.entity().getNetworkType(), SearchCriteria.Op.EQ);
-            sb.join("zoneSb", zoneSb, sb.entity().getDataCenterId(), zoneSb.entity().getId(), JoinBuilder.JoinType.INNER);
-        }
+        zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), zoneId);
 
-        SearchCriteria<HostPodVO> sc = sb.create();
         if (keyword != null) {
             SearchCriteria<HostPodVO> ssc = _hostPodDao.createSearchCriteria();
             ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
@@ -1480,23 +1468,19 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
         }
 
         if (id != null) {
-            sc.setParameters("id", id);
+            sc.addAnd("id", SearchCriteria.Op.EQ, id);
         }
 
         if (podName != null) {
-            sc.setParameters("name", "%" + podName + "%");
+            sc.addAnd("name", SearchCriteria.Op.LIKE, "%" + podName + "%");
         }
 
         if (zoneId != null) {
-            sc.setParameters("dataCenterId", zoneId);
+            sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId);
         }
 
         if (allocationState != null) {
-            sc.setParameters("allocationState", allocationState);
-        }
-
-        if(zoneType != null) {
-            sc.setJoinParameters("zoneSb", "zoneNetworkType", zoneType);
+            sc.addAnd("allocationState", SearchCriteria.Op.EQ, allocationState);
         }
 
         Pair<List<HostPodVO>, Integer> result = _hostPodDao.searchAndCount(sc, searchFilter);