mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-3016: remove zonetype parameter from listClusters API.
This commit is contained in:
parent
9e7356c686
commit
9d0d02222b
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue