cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From muralire...@apache.org
Subject [2/5] git commit: updated refs/heads/regionvpc to 71774f5
Date Fri, 24 Jan 2014 19:08:52 GMT
introduces new capability 'StretchedL2Subnet' for 'Connectivity'
service. Also add support to createNetworkOffering api to allow
StretchedL2Subnet capablity for the connectivity service.


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

Branch: refs/heads/regionvpc
Commit: eb84ab54a13f7eb8e9b9f9f287564e71ce516964
Parents: eb3a87c
Author: Murali Reddy <muralimmreddy@gmail.com>
Authored: Fri Jan 24 16:02:52 2014 +0530
Committer: Murali Reddy <muralimmreddy@gmail.com>
Committed: Fri Jan 24 18:05:36 2014 +0530

----------------------------------------------------------------------
 api/src/com/cloud/offering/NetworkOffering.java |  2 +
 .../org/apache/cloudstack/api/ApiConstants.java |  1 +
 .../command/admin/vpc/CreateVPCOfferingCmd.java |  2 -
 .../api/response/NetworkOfferingResponse.java   |  7 ++++
 .../com/cloud/offerings/NetworkOfferingVO.java  | 11 +++++-
 server/src/com/cloud/api/ApiResponseHelper.java |  3 +-
 .../configuration/ConfigurationManagerImpl.java | 39 +++++++++++++++++++-
 .../cloud/server/ConfigurationServerImpl.java   |  2 +-
 .../cloud/network/CreatePrivateNetworkTest.java |  2 +-
 setup/db/db/schema-430to440.sql                 |  5 ++-
 10 files changed, 66 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb84ab54/api/src/com/cloud/offering/NetworkOffering.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/offering/NetworkOffering.java b/api/src/com/cloud/offering/NetworkOffering.java
index b4f3863..f1ef69c 100644
--- a/api/src/com/cloud/offering/NetworkOffering.java
+++ b/api/src/com/cloud/offering/NetworkOffering.java
@@ -129,4 +129,6 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
     Integer getConcurrentConnections();
 
     boolean isKeepAliveEnabled();
+
+    boolean getSupportsStrechedL2();
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb84ab54/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index 40a8b67..82b3619 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -549,6 +549,7 @@ public class ApiConstants {
     public static final String VERSION = "version";
     public static final String START = "start";
     public static final String SUPPORTS_REGION_LEVEL_VPC = "supportsregionLevelvpc";
+    public static final String SUPPORTS_STRECHED_L2_SUBNET = "supportsstrechedl2subnet";
     public enum HostDetails {
         all, capacity, events, stats, min;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb84ab54/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
index 94e8d64..9158ca9 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
@@ -23,8 +23,6 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.network.Network;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.APICommand;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb84ab54/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java b/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java
index 8219147..55ca2ce 100644
--- a/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java
@@ -116,6 +116,10 @@ public class NetworkOfferingResponse extends BaseResponse {
     @Param(description = "maximum number of concurrents connections to be handled by lb")
     private Integer concurrentConnections;
 
+    @SerializedName(ApiConstants.SUPPORTS_STRECHED_L2_SUBNET)
+    @Param(description = "true if network offering supports network that span multiple zones")
+    private Boolean supportsStrechedL2Subnet;
+
     public void setId(String id) {
         this.id = id;
     }
@@ -200,4 +204,7 @@ public class NetworkOfferingResponse extends BaseResponse {
         this.concurrentConnections = concurrentConnections;
     }
 
+    public void setSupportsStrechedL2Subnet(Boolean supportsStrechedL2Subnet) {
+        this.supportsStrechedL2Subnet = supportsStrechedL2Subnet;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb84ab54/engine/schema/src/com/cloud/offerings/NetworkOfferingVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/offerings/NetworkOfferingVO.java b/engine/schema/src/com/cloud/offerings/NetworkOfferingVO.java
index bf07807..c3d849d 100755
--- a/engine/schema/src/com/cloud/offerings/NetworkOfferingVO.java
+++ b/engine/schema/src/com/cloud/offerings/NetworkOfferingVO.java
@@ -139,6 +139,9 @@ public class NetworkOfferingVO implements NetworkOffering {
     @Column(name = "keep_alive_enabled")
     boolean keepAliveEnabled = false;
 
+    @Column(name="supports_streched_l2")
+    boolean supportsStrechedL2 = false;
+
     @Override
     public String getDisplayText() {
         return displayText;
@@ -331,7 +334,7 @@ public class NetworkOfferingVO implements NetworkOffering {
     public NetworkOfferingVO(String name, String displayText, TrafficType trafficType, boolean
systemOnly, boolean specifyVlan, Integer rateMbps,
             Integer multicastRateMbps, boolean isDefault, Availability availability, String
tags, Network.GuestType guestType, boolean conserveMode, boolean dedicatedLb,
             boolean sharedSourceNat, boolean redundantRouter, boolean elasticIp, boolean
elasticLb, boolean specifyIpRanges, boolean inline, boolean isPersistent,
-            boolean associatePublicIP, boolean publicLb, boolean internalLb, boolean egressdefaultpolicy)
{
+            boolean associatePublicIP, boolean publicLb, boolean internalLb, boolean egressdefaultpolicy,
boolean supportsStrechedL2) {
         this(name,
             displayText,
             trafficType,
@@ -356,6 +359,7 @@ public class NetworkOfferingVO implements NetworkOffering {
         this.inline = inline;
         this.eipAssociatePublicIp = associatePublicIP;
         this.egressdefaultpolicy = egressdefaultpolicy;
+        this.supportsStrechedL2 = supportsStrechedL2;
     }
 
     public NetworkOfferingVO() {
@@ -486,4 +490,9 @@ public class NetworkOfferingVO implements NetworkOffering {
     public void setPublicLb(boolean publicLb) {
         this.publicLb = publicLb;
     }
+
+    @Override
+    public boolean getSupportsStrechedL2() {
+        return supportsStrechedL2;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb84ab54/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 293ae62..d330415 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -1881,6 +1881,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         response.setNetworkRate(ApiDBUtils.getNetworkRate(offering.getId()));
         response.setEgressDefaultPolicy(offering.getEgressDefaultPolicy());
         response.setConcurrentConnections(offering.getConcurrentConnections());
+        response.setSupportsStrechedL2Subnet(offering.getSupportsStrechedL2());
         Long so = null;
         if (offering.getServiceOfferingId() != null) {
             so = offering.getServiceOfferingId();
@@ -2744,7 +2745,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         response.setDisplayText(offering.getDisplayText());
         response.setIsDefault(offering.isDefault());
         response.setState(offering.getState().name());
-        response.setSupportsRegionLevelVpc(offering.supportsRegionLevelVpc());
+        response.setSupportsRegionLevelVpc(offering.offersRegionLevelVPC());
         Map<Service, Set<Provider>> serviceProviderMap = ApiDBUtils.listVpcOffServices(offering.getId());
         List<ServiceResponse> serviceResponses = new ArrayList<ServiceResponse>();
         for (Service service : serviceProviderMap.keySet()) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb84ab54/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 9d148fa..3176636 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -3704,10 +3704,21 @@ public class ConfigurationManagerImpl extends ManagerBase implements
Configurati
         }
         validateStaticNatServiceCapablities(staticNatServiceCapabilityMap);
 
+        // validate the 'Connectivity' service capabilities specified in the network offering,
if 'Connectivity' service
+        // is in the supported services of network offering
+        Map<Capability, String> connectivityServiceCapabilityMap = cmd.getServiceCapabilities(Service.Connectivity);
+        if (!serviceProviderMap.containsKey(Service.Connectivity) &&
+                (connectivityServiceCapabilityMap != null && !connectivityServiceCapabilityMap.isEmpty()))
 {
+            throw new InvalidParameterValueException("Capabilities for 'Connectivity' service
can be specified " +
+                    "only when Connectivity service is enabled for network offering.");
+        }
+        validateConnectivityServiceCapablities(connectivityServiceCapabilityMap);
+
         Map<Service, Map<Capability, String>> serviceCapabilityMap = new HashMap<Service,
Map<Capability, String>>();
         serviceCapabilityMap.put(Service.Lb, lbServiceCapabilityMap);
         serviceCapabilityMap.put(Service.SourceNat, sourceNatServiceCapabilityMap);
         serviceCapabilityMap.put(Service.StaticNat, staticNatServiceCapabilityMap);
+        serviceCapabilityMap.put(Service.Connectivity, connectivityServiceCapabilityMap);
 
         // if Firewall service is missing, add Firewall service/provider
         // combination
@@ -3842,6 +3853,22 @@ public class ConfigurationManagerImpl extends ManagerBase implements
Configurati
         }
     }
 
+    void validateConnectivityServiceCapablities(Map<Capability, String> connectivityServiceCapabilityMap)
{
+        if (connectivityServiceCapabilityMap != null && !connectivityServiceCapabilityMap.isEmpty())
{
+            for (Capability capability: connectivityServiceCapabilityMap.keySet()) {
+                if (capability == Capability.StretchedL2Subnet) {
+                    String value = connectivityServiceCapabilityMap.get(capability).toLowerCase();
+                    if (!(value.contains("true") ^ value.contains("false"))) {
+                        throw new InvalidParameterValueException("Invalid value (" + value
+ ") for " + capability +
+                        " should be true/false");
+                    }
+                } else {
+                    throw new InvalidParameterValueException("Capability " + capability.getName()
+ " can not be "
+                            + " specified with connectivity service.");
+                }
+            }
+        }
+    }
     @Override
     @DB
     public NetworkOfferingVO createNetworkOffering(String name, String displayText, TrafficType
trafficType, String tags, boolean specifyVlan, Availability availability,
@@ -3902,6 +3929,8 @@ public class ConfigurationManagerImpl extends ManagerBase implements
Configurati
         boolean inline = false;
         boolean publicLb = false;
         boolean internalLb = false;
+        boolean strechedL2Subnet = false;
+
         if (serviceCapabilityMap != null && !serviceCapabilityMap.isEmpty()) {
             Map<Capability, String> lbServiceCapabilityMap = serviceCapabilityMap.get(Service.Lb);
 
@@ -3969,6 +3998,14 @@ public class ConfigurationManagerImpl extends ManagerBase implements
Configurati
                     }
                 }
             }
+
+            Map<Capability, String> connectivityServiceCapabilityMap = serviceCapabilityMap.get(Service.Connectivity);
+            if (connectivityServiceCapabilityMap != null && !connectivityServiceCapabilityMap.isEmpty())
{
+                String value = connectivityServiceCapabilityMap.get(Capability.StretchedL2Subnet);
+                if ("true".equalsIgnoreCase(value)) {
+                    strechedL2Subnet = true;
+                }
+            }
         }
 
         if (serviceProviderMap != null && serviceProviderMap.containsKey(Service.Lb)
&& !internalLb && !publicLb) {
@@ -3978,7 +4015,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements
Configurati
 
         final NetworkOfferingVO offeringFinal = new NetworkOfferingVO(name, displayText,
trafficType, systemOnly, specifyVlan, networkRate, multicastRate, isDefault, availability,
                 tags, type, conserveMode, dedicatedLb, sharedSourceNat, redundantRouter,
elasticIp, elasticLb, specifyIpRanges, inline, isPersistent, associatePublicIp, publicLb,
-                internalLb, egressDefaultPolicy);
+                internalLb, egressDefaultPolicy, strechedL2Subnet);
 
         if (serviceOfferingId != null) {
             offeringFinal.setServiceOfferingId(serviceOfferingId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb84ab54/server/src/com/cloud/server/ConfigurationServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java
index cbf3728..1a81e08 100755
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@ -1140,7 +1140,7 @@ public class ConfigurationServerImpl extends ManagerBase implements
Configuratio
                 NetworkOfferingVO defaultNetscalerNetworkOffering =
                     new NetworkOfferingVO(NetworkOffering.DefaultSharedEIPandELBNetworkOffering,
                         "Offering for Shared networks with Elastic IP and Elastic LB capabilities",
TrafficType.Guest, false, true, null, null, true,
-                        Availability.Optional, null, Network.GuestType.Shared, true, false,
false, false, true, true, true, false, false, true, true, false, false);
+                        Availability.Optional, null, Network.GuestType.Shared, true, false,
false, false, true, true, true, false, false, true, true, false, false, false);
 
                 defaultNetscalerNetworkOffering.setState(NetworkOffering.State.Enabled);
                 defaultNetscalerNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultNetscalerNetworkOffering);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb84ab54/server/test/com/cloud/network/CreatePrivateNetworkTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/CreatePrivateNetworkTest.java b/server/test/com/cloud/network/CreatePrivateNetworkTest.java
index dc979d0..b124b20 100644
--- a/server/test/com/cloud/network/CreatePrivateNetworkTest.java
+++ b/server/test/com/cloud/network/CreatePrivateNetworkTest.java
@@ -103,7 +103,7 @@ public class CreatePrivateNetworkTest {
 
         NetworkOfferingVO ntwkOff =
             new NetworkOfferingVO("offer", "fakeOffer", TrafficType.Guest, true, true, null,
null, false, null, null, GuestType.Isolated, false, false, false, false,
-                false, false, false, false, false, false, false, false, false);
+                false, false, false, false, false, false, false, false, false, false);
         when(networkService._networkOfferingDao.findById(anyLong())).thenReturn(ntwkOff);
         List<NetworkOfferingVO> netofferlist = new ArrayList<NetworkOfferingVO>();
         netofferlist.add(ntwkOff);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb84ab54/setup/db/db/schema-430to440.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-430to440.sql b/setup/db/db/schema-430to440.sql
index 0ce9202..34390a2 100644
--- a/setup/db/db/schema-430to440.sql
+++ b/setup/db/db/schema-430to440.sql
@@ -443,4 +443,7 @@ CREATE VIEW `cloud`.`user_vm_view` AS
            left join
         `cloud`.`user_vm_details` `custom_ram_size`  ON (((`custom_ram_size`.`vm_id` = `cloud`.`vm_instance`.`id`)
and (`custom_ram_size`.`name` = 'memory')));
 
-INSERT INTO `cloud`.`configuration`(category, instance, component, name, value, description,
default_value) VALUES ('NetworkManager', 'DEFAULT', 'management-server', 'vm.network.nic.max.secondary.ipaddresses',
NULL, 'Specify the number of secondary ip addresses per nic per vm', '256') ON DUPLICATE KEY
UPDATE category='NetworkManager';
\ No newline at end of file
+INSERT INTO `cloud`.`configuration`(category, instance, component, name, value, description,
default_value) VALUES ('NetworkManager', 'DEFAULT', 'management-server', 'vm.network.nic.max.secondary.ipaddresses',
NULL, 'Specify the number of secondary ip addresses per nic per vm', '256') ON DUPLICATE KEY
UPDATE category='NetworkManager';
+
+ALTER TABLE `cloud`.`vpc_offerings` ADD COLUMN supports_region_level_vpc boolean default
false;
+ALTER TABLE `cloud`.`network_offerings` ADD COLUMN supports_streched_l2 boolean default false;


Mime
View raw message