You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2012/07/24 01:37:40 UTC
[14/14] git commit: CS-15077: fixed listPublicIpAddresses in basic
zone
CS-15077: fixed listPublicIpAddresses in basic zone
Conflicts:
server/src/com/cloud/api/ApiResponseHelper.java
server/src/com/cloud/server/ManagementServerImpl.java
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/9e5fb17e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/9e5fb17e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/9e5fb17e
Branch: refs/heads/vpc
Commit: 9e5fb17e3d1caed094dd962029b206294618303d
Parents: 7bef9a9
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Mon Jul 23 11:16:11 2012 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Mon Jul 23 11:21:28 2012 -0700
----------------------------------------------------------------------
server/src/com/cloud/api/ApiResponseHelper.java | 4 +-
.../src/com/cloud/server/ManagementServerImpl.java | 35 +++++++++-----
2 files changed, 25 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9e5fb17e/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index 4c88e2b..433d263 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -760,7 +760,9 @@ public class ApiResponseHelper implements ResponseGenerator {
ipResponse.setIsSystem(ipAddress.getSystem());
// get account information
- populateOwner(ipResponse, ipAddress);
+ if (ipAddress.getAllocatedToAccountId() != null) {
+ populateOwner(ipResponse, ipAddress);
+ }
ipResponse.setForVirtualNetwork(forVirtualNetworks);
ipResponse.setStaticNat(ipAddress.isOneToOneNat());
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9e5fb17e/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 93c2f4c..047305e 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -1691,23 +1691,30 @@ public class ManagementServerImpl implements ManagementServer {
Boolean staticNat = cmd.getIsStaticNat();
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);
@@ -1760,11 +1767,13 @@ public class ManagementServerImpl implements ManagementServer {
// don't show SSVM/CPVM ips
if (vlanType == VlanType.VirtualNetwork && (allocatedOnly)) {
- sb.and("associatedNetworkId", sb.entity().getAssociatedWithNetworkId(), SearchCriteria.Op.NNULL);
+ sb.and("associatedNetworkId", sb.entity().getAssociatedWithNetworkId(), SearchCriteria.Op.NNULL);
}
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);