cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject [5/11] git commit: VPC: added forVpc parameter to listNetworks api call. If true, list networks not belonging to any vpc
Date Fri, 13 Jul 2012 20:34:35 GMT
VPC: added forVpc parameter to listNetworks api call. If true, list networks not belonging
to any vpc


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/1781f706
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/1781f706
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/1781f706

Branch: refs/heads/vpc
Commit: 1781f706f97001aeb6a34e025fbf6c0056a1827d
Parents: b475396
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Thu Jul 12 09:08:39 2012 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Fri Jul 13 13:27:10 2012 -0700

----------------------------------------------------------------------
 .../com/cloud/api/commands/ListNetworksCmd.java    |    7 +++++++
 .../src/com/cloud/network/NetworkManagerImpl.java  |    9 +++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1781f706/api/src/com/cloud/api/commands/ListNetworksCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListNetworksCmd.java b/api/src/com/cloud/api/commands/ListNetworksCmd.java
index 14659dc..61aff01 100644
--- a/api/src/com/cloud/api/commands/ListNetworksCmd.java
+++ b/api/src/com/cloud/api/commands/ListNetworksCmd.java
@@ -79,6 +79,9 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
 
     @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")
+    private Boolean forVpc;
    
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
@@ -131,6 +134,10 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
 	public Boolean canUseForDeploy() {
         return canUseForDeploy;
     }
+	
+    public Boolean getForVpc() {
+        return forVpc;
+    }
 
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1781f706/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index d39526a..850051a 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -3119,6 +3119,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService,
Manag
         Long vpcId = cmd.getVpcId();
         Boolean canUseForDeploy = cmd.canUseForDeploy();
         Map<String, String> tags = cmd.getTags();
+        Boolean forVpc = cmd.getForVpc();
 
         // 1) default is system to false if not specified
         // 2) reset parameter to false if it's specified by the regular user
@@ -3189,6 +3190,14 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService,
Manag
 
         Filter searchFilter = new Filter(NetworkVO.class, "id", false, cmd.getStartIndex(),
cmd.getPageSizeVal());
         SearchBuilder<NetworkVO> sb = _networksDao.createSearchBuilder();
+        
+        if (forVpc != null) {
+            if (forVpc) {
+                sb.and("vpc", sb.entity().getVpcId(), Op.NNULL);
+            } else {
+                sb.and("vpc", sb.entity().getVpcId(), Op.NULL);
+            }
+        }
 
         // Don't display networks created of system network offerings
         SearchBuilder<NetworkOfferingVO> networkOfferingSearch = _networkOfferingDao.createSearchBuilder();


Mime
View raw message