Skip to content

Commit 7a929d1

Browse files
committed
region level VPC support
introduce 'RegionLevelVpc' as capability of 'Connectivity' service. Add support for CreateVPCOffering to take the 'regionlevelvpc' as capability of service 'connectivity'. introduces new capability 'StretchedL2Subnet' for 'Connectivity' service. Also add support to createNetworkOffering api to allow StretchedL2Subnet capablity for the connectivity service. adds check to ensure 'Connectivity' service provider supports 'StretchedL2Subnet' and 'RegionLevelVpc' capabilities when specified in createNetworkOffering and createVpcOffering respectivley enable ovs plug-in to support both StretchedL2Subnet and RegionLevelVpc capabilities make zone id optional parameter in createVpc, zone id can be null only if vpc offfering supports region level VPC in region level vpc, let the network/tier to be created in any zone of the region keep zoneid as required param for createVpc skip external guest network guru if 'Connectivy' service is present in network offering fix build break in contrail manager permit VM's to be created in different zone that in which network is created if the network support streched L2 subnet add integration tests for region level VPC rebase to master Conflicts: setup/db/db/schema-430to440.sql
1 parent 5c37249 commit 7a929d1

28 files changed

Lines changed: 847 additions & 103 deletions

File tree

api/src/com/cloud/network/Network.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static class Service {
5757
public static final Service PortForwarding = new Service("PortForwarding");
5858
public static final Service SecurityGroup = new Service("SecurityGroup");
5959
public static final Service NetworkACL = new Service("NetworkACL", Capability.SupportedProtocols);
60-
public static final Service Connectivity = new Service("Connectivity", Capability.DistributedRouter);
60+
public static final Service Connectivity = new Service("Connectivity", Capability.DistributedRouter, Capability.RegionLevelVpc, Capability.StretchedL2Subnet);
6161

6262
private final String name;
6363
private final Capability[] caps;
@@ -187,6 +187,8 @@ public static class Capability {
187187
public static final Capability LbSchemes = new Capability("LbSchemes");
188188
public static final Capability DhcpAccrossMultipleSubnets = new Capability("DhcpAccrossMultipleSubnets");
189189
public static final Capability DistributedRouter = new Capability("DistributedRouter");
190+
public static final Capability StretchedL2Subnet = new Capability("StretchedL2Subnet");
191+
public static final Capability RegionLevelVpc = new Capability("RegionLevelVpc");
190192

191193
private final String name;
192194

@@ -337,4 +339,6 @@ public void setIp6Address(String ip6Address) {
337339
Long getNetworkACLId();
338340

339341
void setNetworkACLId(Long networkACLId);
342+
343+
boolean isStrechedL2Network();
340344
}

api/src/com/cloud/network/NetworkProfile.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public class NetworkProfile implements Network {
5757
private final boolean displayNetwork;
5858
private Long networkAclId;
5959
private final String guruName;
60+
private boolean strechedL2Subnet;
6061

6162
public NetworkProfile(Network network) {
6263
id = network.getId();
@@ -89,6 +90,7 @@ public NetworkProfile(Network network) {
8990
displayNetwork = network.getDisplayNetwork();
9091
networkAclId = network.getNetworkACLId();
9192
guruName = network.getGuruName();
93+
strechedL2Subnet = network.isStrechedL2Network();
9294
}
9395

9496
public String getDns1() {
@@ -282,4 +284,10 @@ public String getIp6Cidr() {
282284
public IAMEntityType getEntityType() {
283285
return IAMEntityType.Network;
284286
}
287+
288+
@Override
289+
public boolean isStrechedL2Network() {
290+
return false;
291+
}
292+
285293
}

api/src/com/cloud/network/vpc/Vpc.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,10 @@ public enum State {
7979
* @return true if VPC is configured to use distributed router to provides one-hop forwarding and hypervisor based ACL
8080
*/
8181
boolean usesDistributedRouter();
82+
83+
/**
84+
*
85+
* @return true if VPC spans multiple zones in the region
86+
*/
87+
boolean isRegionLevelVpc();
8288
}

api/src/com/cloud/network/vpc/VpcOffering.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ public enum State {
5656
Long getServiceOfferingId();
5757

5858
/**
59-
*
6059
* @return true if the offering provides a distributed router capable of one-hop forwarding
6160
*/
6261
boolean supportsDistributedRouter();
62+
63+
/**
64+
* @return true if VPC created with the offering can span multiple zones in the region
65+
*/
66+
boolean offersRegionLevelVPC();
6367
}

api/src/com/cloud/network/vpc/VpcProvisioningService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// under the License.
1717
package com.cloud.network.vpc;
1818

19+
1920
import java.util.List;
2021
import java.util.Map;
2122

api/src/com/cloud/offering/NetworkOffering.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,6 @@ public enum Detail {
129129
Integer getConcurrentConnections();
130130

131131
boolean isKeepAliveEnabled();
132+
133+
boolean getSupportsStrechedL2();
132134
}

api/src/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,9 @@ public class ApiConstants {
589589
public static final String VGPUTYPE = "vgputype";
590590
public static final String REMAININGCAPACITY = "remainingcapacity";
591591
public static final String DISTRIBUTED_VPC_ROUTER = "distributedvpcrouter";
592-
592+
public static final String SUPPORTS_REGION_LEVEL_VPC = "supportsregionLevelvpc";
593+
public static final String SUPPORTS_STRECHED_L2_SUBNET = "supportsstrechedl2subnet";
594+
public static final String REGION_LEVEL_VPC = "regionlevelvpc";
593595

594596
public enum HostDetails {
595597
all, capacity, events, stats, min;

api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd {
6565
private Long projectId;
6666

6767
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class,
68-
required = true, description = "the ID of the availability zone")
68+
required = true, description = "the ID of the availability zone")
6969
private Long zoneId;
7070

7171
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the VPC")

api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ public class NetworkOfferingResponse extends BaseResponse {
116116
@Param(description = "maximum number of concurrents connections to be handled by lb")
117117
private Integer concurrentConnections;
118118

119+
@SerializedName(ApiConstants.SUPPORTS_STRECHED_L2_SUBNET)
120+
@Param(description = "true if network offering supports network that span multiple zones")
121+
private Boolean supportsStrechedL2Subnet;
122+
119123
public void setId(String id) {
120124
this.id = id;
121125
}
@@ -200,4 +204,7 @@ public void setConcurrentConnections(Integer concurrentConnections) {
200204
this.concurrentConnections = concurrentConnections;
201205
}
202206

207+
public void setSupportsStrechedL2Subnet(Boolean supportsStrechedL2Subnet) {
208+
this.supportsStrechedL2Subnet = supportsStrechedL2Subnet;
209+
}
203210
}

api/src/org/apache/cloudstack/api/response/VpcOfferingResponse.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ public class VpcOfferingResponse extends BaseResponse {
6363
@Param(description = " indicates if the vpc offering supports distributed router for one-hop forwarding")
6464
private Boolean supportsDistributedRouter;
6565

66+
@SerializedName((ApiConstants.SUPPORTS_REGION_LEVEL_VPC))
67+
@Param(description = " indicated if the offering can support region level vpc")
68+
private Boolean supportsRegionLevelVpc;
69+
6670
public void setId(String id) {
6771
this.id = id;
6872
}
@@ -94,4 +98,8 @@ public void setState(String state) {
9498
public void setSupportsDistributedRouter(Boolean supportsDistributedRouter) {
9599
this.supportsDistributedRouter = supportsDistributedRouter;
96100
}
101+
102+
public void setSupportsRegionLevelVpc(Boolean supports) {
103+
this.supportsRegionLevelVpc = supports;
104+
}
97105
}

0 commit comments

Comments
 (0)