mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-3016: remove zonetype parameter from listPods API.
This commit is contained in:
parent
9d0d02222b
commit
56d390d54e
@ -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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user