mirror of https://github.com/apache/cloudstack.git
CS-15077: fixed listPublicIpAddresses in basic zone
This commit is contained in:
parent
3e4d7babc3
commit
a867e7e5a8
|
|
@ -774,7 +774,9 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
ipResponse.setIsSystem(ipAddr.getSystem());
|
||||
|
||||
// get account information
|
||||
populateOwner(ipResponse, ipAddr);
|
||||
if (ipAddr.getAllocatedToAccountId() != null) {
|
||||
populateOwner(ipResponse, ipAddr);
|
||||
}
|
||||
|
||||
ipResponse.setForVirtualNetwork(forVirtualNetworks);
|
||||
ipResponse.setStaticNat(ipAddr.isOneToOneNat());
|
||||
|
|
|
|||
|
|
@ -1710,23 +1710,30 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
Long vpcId = cmd.getVpcId();
|
||||
Map<String, String> tags = cmd.getTags();
|
||||
|
||||
Account caller = UserContext.current().getCaller();
|
||||
List<Long> permittedAccounts = new ArrayList<Long>();
|
||||
|
||||
|
||||
Boolean isAllocated = cmd.isAllocatedOnly();
|
||||
if (isAllocated == null) {
|
||||
isAllocated = Boolean.TRUE;
|
||||
}
|
||||
|
||||
Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject = new Ternary<Long, Boolean, ListProjectResourcesCriteria>(cmd.getDomainId(), cmd.isRecursive(), null);
|
||||
_accountMgr.buildACLSearchParameters(caller, cmd.getId(), cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, cmd.listAll(), false);
|
||||
Long domainId = domainIdRecursiveListProject.first();
|
||||
Boolean isRecursive = domainIdRecursiveListProject.second();
|
||||
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.third();
|
||||
|
||||
|
||||
Filter searchFilter = new Filter(IPAddressVO.class, "address", false, cmd.getStartIndex(), cmd.getPageSizeVal());
|
||||
SearchBuilder<IPAddressVO> sb = _publicIpAddressDao.createSearchBuilder();
|
||||
_accountMgr.buildACLSearchBuilder(sb, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
|
||||
Long domainId = null;
|
||||
Boolean isRecursive = null;
|
||||
List<Long> permittedAccounts = new ArrayList<Long>();
|
||||
ListProjectResourcesCriteria listProjectResourcesCriteria = null;
|
||||
if (isAllocated) {
|
||||
Account caller = UserContext.current().getCaller();
|
||||
|
||||
Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject =
|
||||
new Ternary<Long, Boolean, ListProjectResourcesCriteria>(cmd.getDomainId(), cmd.isRecursive(), null);
|
||||
_accountMgr.buildACLSearchParameters(caller, cmd.getId(), cmd.getAccountName(), cmd.getProjectId(),
|
||||
permittedAccounts, domainIdRecursiveListProject, cmd.listAll(), false);
|
||||
domainId = domainIdRecursiveListProject.first();
|
||||
isRecursive = domainIdRecursiveListProject.second();
|
||||
listProjectResourcesCriteria = domainIdRecursiveListProject.third();
|
||||
_accountMgr.buildACLSearchBuilder(sb, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
|
||||
}
|
||||
|
||||
sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||
sb.and("address", sb.entity().getAddress(), SearchCriteria.Op.EQ);
|
||||
|
|
@ -1788,13 +1795,13 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
nonSystemVmSearch.cp();
|
||||
sb.join("nonSystemVms", nonSystemVmSearch, sb.entity().getAddress(),
|
||||
nonSystemVmSearch.entity().getIp4Address(), JoinType.LEFTOUTER);
|
||||
// sb.and().join("nonSystemVms", nonSystemVmSearch, sb.entity().getSourceNetworkId(),
|
||||
// nonSystemVmSearch.entity().getNetworkId(), JoinType.INNER);
|
||||
omitSystemVmIps = true;
|
||||
}
|
||||
|
||||
SearchCriteria<IPAddressVO> sc = sb.create();
|
||||
_accountMgr.buildACLSearchCriteria(sc, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
|
||||
if (isAllocated) {
|
||||
_accountMgr.buildACLSearchCriteria(sc, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
|
||||
}
|
||||
|
||||
sc.setJoinParameters("vlanSearch", "vlanType", vlanType);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue