You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2013/06/18 05:07:05 UTC
[40/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1
CLOUDSTACK-3016: remove zonetype parameter from listClusters API.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9d0d0222
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9d0d0222
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9d0d0222
Branch: refs/heads/vmsync
Commit: 9d0d02222b4083fe3cb9f5aac9deb5be12bea018
Parents: 9e7356c
Author: Jessica Wang <je...@apache.org>
Authored: Mon Jun 17 15:28:39 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Mon Jun 17 15:28:39 2013 -0700
----------------------------------------------------------------------
.../command/admin/cluster/ListClustersCmd.java | 8 +---
.../com/cloud/server/ManagementServerImpl.java | 45 ++++++--------------
2 files changed, 13 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9d0d0222/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
index f2dd349..0417b18 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
@@ -70,9 +70,6 @@ public class ListClustersCmd extends BaseListCmd {
@Parameter(name=ApiConstants.MANAGED_STATE, type=CommandType.STRING, description="whether this cluster is managed by cloudstack")
private String managedState;
- @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 clusters")
private Boolean showCapacities;
@@ -117,10 +114,7 @@ public class ListClustersCmd extends BaseListCmd {
this.managedState = managedstate;
}
- public String getZoneType() {
- return zoneType;
- }
-
+
public Boolean getShowCapacities() {
return showCapacities;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9d0d0222/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 96c72e4..f09aa21 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -996,67 +996,46 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
@Override
public Pair<List<? extends Cluster>, Integer> searchForClusters(ListClustersCmd cmd) {
- Object id = cmd.getId();
+ Filter searchFilter = new Filter(ClusterVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());
+ SearchCriteria<ClusterVO> sc = _clusterDao.createSearchCriteria();
+
+ Object id = cmd.getId();
Object name = cmd.getClusterName();
Object podId = cmd.getPodId();
Long zoneId = cmd.getZoneId();
Object hypervisorType = cmd.getHypervisorType();
Object clusterType = cmd.getClusterType();
Object allocationState = cmd.getAllocationState();
- String zoneType = cmd.getZoneType();
String keyword = cmd.getKeyword();
- zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), zoneId);
-
-
- Filter searchFilter = new Filter(ClusterVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());
-
- SearchBuilder<ClusterVO> sb = _clusterDao.createSearchBuilder();
- sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
- sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
- sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
- sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
- sb.and("hypervisorType", sb.entity().getHypervisorType(), SearchCriteria.Op.EQ);
- sb.and("clusterType", sb.entity().getClusterType(), 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<ClusterVO> sc = sb.create();
if (id != null) {
- sc.setParameters("id", id);
+ sc.addAnd("id", SearchCriteria.Op.EQ, id);
}
if (name != null) {
- sc.setParameters("name", "%" + name + "%");
+ sc.addAnd("name", SearchCriteria.Op.LIKE, "%" + name + "%");
}
if (podId != null) {
- sc.setParameters("podId", podId);
+ sc.addAnd("podId", SearchCriteria.Op.EQ, podId);
}
if (zoneId != null) {
- sc.setParameters("dataCenterId", zoneId);
+ sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId);
}
if (hypervisorType != null) {
- sc.setParameters("hypervisorType", hypervisorType);
+ sc.addAnd("hypervisorType", SearchCriteria.Op.EQ, hypervisorType);
}
if (clusterType != null) {
- sc.setParameters("clusterType", clusterType);
+ sc.addAnd("clusterType", SearchCriteria.Op.EQ, clusterType);
}
if (allocationState != null) {
- sc.setParameters("allocationState", allocationState);
- }
-
- if(zoneType != null) {
- sc.setJoinParameters("zoneSb", "zoneNetworkType", zoneType);
+ sc.addAnd("allocationState", SearchCriteria.Op.EQ, allocationState);
}
if (keyword != null) {