cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From muralire...@apache.org
Subject [45/50] [abbrv] git commit: updated refs/heads/distributedrouter to 6b5e234
Date Tue, 11 Mar 2014 13:13:42 GMT
mark VPC to be using distributed router if VPC offerign supports
distributedrouter capability.


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

Branch: refs/heads/distributedrouter
Commit: beafb0ea2ba08367b70e2a46627cf5841494b812
Parents: c7529d8
Author: Murali Reddy <muralimmreddy@gmail.com>
Authored: Tue Mar 4 18:17:02 2014 +0530
Committer: Murali Reddy <muralimmreddy@gmail.com>
Committed: Tue Mar 11 18:38:44 2014 +0530

----------------------------------------------------------------------
 api/src/com/cloud/network/vpc/Vpc.java                 |  6 ++++++
 .../apache/cloudstack/api/response/VpcResponse.java    |  9 +++++++++
 engine/schema/src/com/cloud/network/vpc/VpcVO.java     | 13 +++++++++++--
 server/src/com/cloud/api/ApiResponseHelper.java        |  1 +
 server/src/com/cloud/network/vpc/VpcManagerImpl.java   |  9 +++++----
 server/test/com/cloud/vpc/VpcApiUnitTest.java          |  2 +-
 server/test/com/cloud/vpc/dao/MockVpcDaoImpl.java      |  4 ++--
 setup/db/db/schema-430to440.sql                        |  1 +
 8 files changed, 36 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/beafb0ea/api/src/com/cloud/network/vpc/Vpc.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpc/Vpc.java b/api/src/com/cloud/network/vpc/Vpc.java
index eb7e391..4bc8c98 100644
--- a/api/src/com/cloud/network/vpc/Vpc.java
+++ b/api/src/com/cloud/network/vpc/Vpc.java
@@ -73,4 +73,10 @@ public interface Vpc extends ControlledEntity, Identity, InternalIdentity
{
     boolean isRestartRequired();
 
     boolean isDisplay();
+
+    /**
+     *
+     * @return true if VPC is configured to use distributed router to provides one-hop forwarding
and hypervisor based ACL
+     */
+    boolean usesDistributedRouter();
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/beafb0ea/api/src/org/apache/cloudstack/api/response/VpcResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/VpcResponse.java b/api/src/org/apache/cloudstack/api/response/VpcResponse.java
index eeafb40..e3b44f2 100644
--- a/api/src/org/apache/cloudstack/api/response/VpcResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/VpcResponse.java
@@ -111,6 +111,11 @@ public class VpcResponse extends BaseResponse implements ControlledEntityRespons
     @Param(description = "is vpc for display to the regular user", since = "4.4", authorized
= {RoleType.Admin})
     private Boolean forDisplay;
 
+
+    @SerializedName(ApiConstants.DISTRIBUTED_VPC_ROUTER)
+    @Param(description = "is VPC uses distributed router for one hop forwarding and host
based network ACL's")
+    private boolean usesDistributedRouter;
+
     public void setId(String id) {
         this.id = id;
     }
@@ -199,4 +204,8 @@ public class VpcResponse extends BaseResponse implements ControlledEntityRespons
     public void setForDisplay(Boolean forDisplay) {
         this.forDisplay = forDisplay;
     }
+
+    public void setUsesDistributedRouter(Boolean usesDistributedRouter) {
+        this.usesDistributedRouter = usesDistributedRouter;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/beafb0ea/engine/schema/src/com/cloud/network/vpc/VpcVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/VpcVO.java b/engine/schema/src/com/cloud/network/vpc/VpcVO.java
index d1cfd7c..5cf8aed 100644
--- a/engine/schema/src/com/cloud/network/vpc/VpcVO.java
+++ b/engine/schema/src/com/cloud/network/vpc/VpcVO.java
@@ -81,11 +81,15 @@ public class VpcVO implements Vpc {
     @Column(name = "display", updatable = true, nullable = false)
     protected boolean display = true;
 
+    @Column(name="uses_distributed_router")
+    boolean usesDistributedRouter = false;
+
     public VpcVO() {
         uuid = UUID.randomUUID().toString();
     }
 
-    public VpcVO(long zoneId, String name, String displayText, long accountId, long domainId,
long vpcOffId, String cidr, String networkDomain) {
+    public VpcVO(long zoneId, String name, String displayText, long accountId, long domainId,
long vpcOffId, String cidr,
+                 String networkDomain, boolean useDistributedRouter) {
         this.zoneId = zoneId;
         this.name = name;
         this.displayText = displayText;
@@ -95,7 +99,8 @@ public class VpcVO implements Vpc {
         uuid = UUID.randomUUID().toString();
         state = State.Enabled;
         this.networkDomain = networkDomain;
-        vpcOfferingId = vpcOffId;
+        this.vpcOfferingId = vpcOffId;
+        this.usesDistributedRouter = useDistributedRouter;
     }
 
     @Override
@@ -200,5 +205,9 @@ public class VpcVO implements Vpc {
     @Override
     public IAMEntityType getEntityType() {
         return IAMEntityType.Vpc;
+
+    @Override
+    public boolean usesDistributedRouter() {
+        return usesDistributedRouter;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/beafb0ea/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 73c9c6b..fe7fe55 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -2791,6 +2791,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         response.setRestartRequired(vpc.isRestartRequired());
         response.setNetworkDomain(vpc.getNetworkDomain());
         response.setForDisplay(vpc.isDisplay());
+        response.setUsesDistributedRouter(vpc.usesDistributedRouter());
 
         Map<Service, Set<Provider>> serviceProviderMap = ApiDBUtils.listVpcOffServices(vpc.getVpcOfferingId());
         List<ServiceResponse> serviceResponses = new ArrayList<ServiceResponse>();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/beafb0ea/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index 5abc5e8..f4f8772 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -728,13 +728,13 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager,
VpcProvis
                 networkDomain = "cs" + Long.toHexString(owner.getId()) + NetworkOrchestrationService.GuestDomainSuffix.valueIn(zoneId);
             }
         }
-
-        return createVpc(zoneId, vpcOffId, owner, vpcName, displayText, cidr, networkDomain,
displayVpc);
+        boolean useDistributedRouter = vpcOff.supportsDistributedRouter();
+        return createVpc(zoneId, vpcOffId, owner, vpcName, displayText, cidr, networkDomain,
displayVpc, useDistributedRouter);
     }
 
     @DB
     protected Vpc createVpc(final long zoneId, final long vpcOffId, final Account vpcOwner,
final String vpcName, final String displayText, final String cidr,
-            final String networkDomain, final Boolean displayVpc) {
+            final String networkDomain, final Boolean displayVpc, final boolean useDistributedRouter)
{
 
         //Validate CIDR
         if (!NetUtils.isValidCIDR(cidr)) {
@@ -756,7 +756,8 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager,
VpcProvis
         return Transaction.execute(new TransactionCallback<VpcVO>() {
             @Override
             public VpcVO doInTransaction(TransactionStatus status) {
-                VpcVO vpc = new VpcVO(zoneId, vpcName, displayText, vpcOwner.getId(), vpcOwner.getDomainId(),
vpcOffId, cidr, networkDomain);
+                VpcVO vpc = new VpcVO(zoneId, vpcName, displayText, vpcOwner.getId(), vpcOwner.getDomainId(),
vpcOffId,
+                        cidr, networkDomain, useDistributedRouter);
                 if (displayVpc != null) {
                     vpc.setDisplay(displayVpc);
                 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/beafb0ea/server/test/com/cloud/vpc/VpcApiUnitTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/VpcApiUnitTest.java b/server/test/com/cloud/vpc/VpcApiUnitTest.java
index bc982a9..5e28374 100644
--- a/server/test/com/cloud/vpc/VpcApiUnitTest.java
+++ b/server/test/com/cloud/vpc/VpcApiUnitTest.java
@@ -85,7 +85,7 @@ public class VpcApiUnitTest extends TestCase {
     public void validateNtwkOffForVpc() {
         //validate network offering
         //1) correct network offering
-        VpcVO vo = new VpcVO(1, "new vpc", "new vpc", 1, 1, 1, "0.0.0.0/0", "vpc domain");
+        VpcVO vo = new VpcVO(1, "new vpc", "new vpc", 1, 1, 1, "0.0.0.0/0", "vpc domain",
false);
         boolean result = false;
         try {
             _vpcService.validateNtwkOffForNtwkInVpc(2L, 1, "0.0.0.0", "111-", vo, "10.1.1.1",
new AccountVO(), null);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/beafb0ea/server/test/com/cloud/vpc/dao/MockVpcDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/dao/MockVpcDaoImpl.java b/server/test/com/cloud/vpc/dao/MockVpcDaoImpl.java
index 7a0c7a0..e1a6ac2 100644
--- a/server/test/com/cloud/vpc/dao/MockVpcDaoImpl.java
+++ b/server/test/com/cloud/vpc/dao/MockVpcDaoImpl.java
@@ -98,9 +98,9 @@ public class MockVpcDaoImpl extends GenericDaoBase<VpcVO, Long> implements
VpcDa
     public VpcVO findById(Long id) {
         VpcVO vo = null;
         if (id.longValue() == 1) {
-            vo = new VpcVO(1, "new vpc", "new vpc", 1, 1, 1, "0.0.0.0/0", "vpc domain");
+            vo = new VpcVO(1, "new vpc", "new vpc", 1, 1, 1, "0.0.0.0/0", "vpc domain", false);
         } else if (id.longValue() == 2) {
-            vo = new VpcVO(1, "new vpc", "new vpc", 1, 1, 1, "0.0.0.0/0", "vpc domain");
+            vo = new VpcVO(1, "new vpc", "new vpc", 1, 1, 1, "0.0.0.0/0", "vpc domain", false);
             vo.setState(State.Inactive);
         }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/beafb0ea/setup/db/db/schema-430to440.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-430to440.sql b/setup/db/db/schema-430to440.sql
index ff9c47f..530ccbc 100644
--- a/setup/db/db/schema-430to440.sql
+++ b/setup/db/db/schema-430to440.sql
@@ -612,3 +612,4 @@ CREATE TABLE `cloud`.`vgpu_types` (
 ) ENGINE=InnoDB CHARSET=utf8;
 
 ALTER TABLE `cloud`.`vpc_offerings` ADD COLUMN supports_distributed_router boolean default
false;
+ALTER TABLE `cloud`.`vpc` ADD COLUMN uses_distributed_router  boolean default false;


Mime
View raw message