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 2013/12/24 02:06:21 UTC
[3/3] git commit: updated refs/heads/4.3 to 632346d
CLOUDSTACK-5390: when calculate index (page #) in NetworkManager, rely on fact that getStartIndex() returned by API, returns pageSize*(page-1). So to get index(page), you need to do the reverse calculation
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/632346d6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/632346d6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/632346d6
Branch: refs/heads/4.3
Commit: 632346d6a5ed1f50fbb160e2d25917f911c22d8a
Parents: d8ee318
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Mon Dec 23 16:53:46 2013 -0800
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Mon Dec 23 16:53:46 2013 -0800
----------------------------------------------------------------------
api/src/com/cloud/network/NetworkService.java | 2 +-
.../command/user/network/ListNetworksCmd.java | 42 +-
.../com/cloud/network/NetworkServiceImpl.java | 963 +++++++++----------
.../com/cloud/vpc/MockNetworkManagerImpl.java | 3 +-
4 files changed, 471 insertions(+), 539 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/632346d6/api/src/com/cloud/network/NetworkService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/NetworkService.java b/api/src/com/cloud/network/NetworkService.java
index b91a63d..85668b5 100755
--- a/api/src/com/cloud/network/NetworkService.java
+++ b/api/src/com/cloud/network/NetworkService.java
@@ -64,7 +64,7 @@ public interface NetworkService {
Network createGuestNetwork(CreateNetworkCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException,
ResourceAllocationException;
- List<? extends Network> searchForNetworks(ListNetworksCmd cmd);
+ Pair<List<? extends Network>, Integer> searchForNetworks(ListNetworksCmd cmd);
boolean deleteNetwork(long networkId);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/632346d6/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
index afce092..97cfbae 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
@@ -31,8 +31,9 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
import com.cloud.network.Network;
+import com.cloud.utils.Pair;
-@APICommand(name = "listNetworks", description="Lists all available networks.", responseObject=NetworkResponse.class)
+@APICommand(name = "listNetworks", description = "Lists all available networks.", responseObject = NetworkResponse.class)
public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
public static final Logger s_logger = Logger.getLogger(ListNetworksCmd.class.getName());
private static final String _name = "listnetworksresponse";
@@ -40,48 +41,43 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = NetworkResponse.class,
- description="list networks by id")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "list networks by id")
private Long id;
- @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
- description="the Zone ID of the network")
+ @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the Zone ID of the network")
private Long zoneId;
- @Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, description="the type of the network. Supported values are: Isolated and Shared")
+ @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "the type of the network. Supported values are: Isolated and Shared")
private String guestIpType;
- @Parameter(name=ApiConstants.IS_SYSTEM, type=CommandType.BOOLEAN, description="true if network is system, false otherwise")
+ @Parameter(name = ApiConstants.IS_SYSTEM, type = CommandType.BOOLEAN, description = "true if network is system, false otherwise")
private Boolean isSystem;
- @Parameter(name=ApiConstants.ACL_TYPE, type=CommandType.STRING, description="list networks by ACL (access control list) type. Supported values are Account and Domain")
+ @Parameter(name = ApiConstants.ACL_TYPE, type = CommandType.STRING, description = "list networks by ACL (access control list) type. Supported values are Account and Domain")
private String aclType;
- @Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="type of the traffic")
+ @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "type of the traffic")
private String trafficType;
- @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, entityType = PhysicalNetworkResponse.class,
- description="list networks by physical network id")
+ @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, description = "list networks by physical network id")
private Long physicalNetworkId;
- @Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, collectionType=CommandType.STRING, description="list networks supporting certain services")
+ @Parameter(name = ApiConstants.SUPPORTED_SERVICES, type = CommandType.LIST, collectionType = CommandType.STRING, description = "list networks supporting certain services")
private List<String> supportedServices;
- @Parameter(name=ApiConstants.RESTART_REQUIRED, type=CommandType.BOOLEAN, description="list networks by restartRequired")
-
+ @Parameter(name = ApiConstants.RESTART_REQUIRED, type = CommandType.BOOLEAN, description = "list networks by restartRequired")
private Boolean restartRequired;
- @Parameter(name=ApiConstants.SPECIFY_IP_RANGES, type=CommandType.BOOLEAN, description="true if need to list only networks which support specifying ip ranges")
+ @Parameter(name = ApiConstants.SPECIFY_IP_RANGES, type = CommandType.BOOLEAN, description = "true if need to list only networks which support specifying ip ranges")
private Boolean specifyIpRanges;
- @Parameter(name=ApiConstants.VPC_ID, type=CommandType.UUID, entityType = VpcResponse.class,
- description="List networks by VPC")
+ @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "List networks by VPC")
private Long vpcId;
- @Parameter(name=ApiConstants.CAN_USE_FOR_DEPLOY, type=CommandType.BOOLEAN, description="list networks available for vm deployment")
+ @Parameter(name = ApiConstants.CAN_USE_FOR_DEPLOY, type = CommandType.BOOLEAN, description = "list networks available for vm deployment")
private Boolean canUseForDeploy;
- @Parameter(name=ApiConstants.FOR_VPC, type=CommandType.BOOLEAN, description="the network belongs to vpc")
+ @Parameter(name = ApiConstants.FOR_VPC, type = CommandType.BOOLEAN, description = "the network belongs to vpc")
private Boolean forVpc;
/////////////////////////////////////////////////////
@@ -149,16 +145,16 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
}
@Override
- public void execute(){
- List<? extends Network> networks = _networkService.searchForNetworks(this);
+ public void execute() {
+ Pair<List<? extends Network>, Integer> networks = _networkService.searchForNetworks(this);
ListResponse<NetworkResponse> response = new ListResponse<NetworkResponse>();
List<NetworkResponse> networkResponses = new ArrayList<NetworkResponse>();
- for (Network network : networks) {
+ for (Network network : networks.first()) {
NetworkResponse networkResponse = _responseGenerator.createNetworkResponse(network);
networkResponses.add(networkResponse);
}
- response.setResponses(networkResponses);
+ response.setResponses(networkResponses, networks.second());
response.setResponseName(getCommandName());
this.setResponseObject(response);
}