cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aprat...@apache.org
Subject git commit: updated refs/heads/4.2 to 6f9c26e
Date Mon, 29 Jul 2013 04:48:31 GMT
Updated Branches:
  refs/heads/4.2 7ba5d9910 -> 6f9c26ea4


Cloudstack-2997 Make haproxy maxconn configurable

Signed-off-by: Abhinandan Prateek <aprateek@apache.org>

Conflicts:
	api/src/org/apache/cloudstack/api/ApiConstants.java
	engine/schema/src/com/cloud/offerings/NetworkOfferingVO.java
	server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
	setup/db/db/schema-410to420.sql


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

Branch: refs/heads/4.2
Commit: 6f9c26ea49855e4ecccf5649af94414169b6f472
Parents: 7ba5d99
Author: Bharat Kumar <bharat.kumar@citrix.com>
Authored: Tue Jun 25 18:13:31 2013 +0530
Committer: Abhinandan Prateek <aprateek@apache.org>
Committed: Mon Jul 29 10:07:15 2013 +0530

----------------------------------------------------------------------
 api/src/com/cloud/offering/NetworkOffering.java |  1 +
 .../org/apache/cloudstack/api/ApiConstants.java |  2 ++
 .../admin/network/CreateNetworkOfferingCmd.java |  7 +++++++
 .../admin/network/UpdateNetworkOfferingCmd.java |  6 ++++++
 .../api/routing/LoadBalancerConfigCommand.java  |  4 +++-
 .../com/cloud/network/HAProxyConfigurator.java  |  5 +++--
 .../com/cloud/offerings/NetworkOfferingVO.java  | 10 ++++++++++
 .../lb/ElasticLoadBalancerManagerImpl.java      | 10 +++++++++-
 .../lb/InternalLoadBalancerVMManagerImpl.java   | 14 +++++++++++---
 .../InternalLBVMManagerTest.java                |  9 +++++++--
 server/src/com/cloud/configuration/Config.java  |  1 +
 .../configuration/ConfigurationManager.java     |  2 +-
 .../configuration/ConfigurationManagerImpl.java | 20 +++++++++++++++++---
 .../com/cloud/network/NetworkManagerImpl.java   | 18 +++++++++---------
 .../VirtualNetworkApplianceManagerImpl.java     | 15 +++++++++++----
 .../cloud/vpc/MockConfigurationManagerImpl.java |  2 +-
 .../CreateNetworkOfferingTest.java              | 20 ++++++++++----------
 setup/db/db/schema-410to420.sql                 |  3 +++
 18 files changed, 112 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f9c26ea/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 43312db..6c5573e 100644
--- a/api/src/com/cloud/offering/NetworkOffering.java
+++ b/api/src/com/cloud/offering/NetworkOffering.java
@@ -129,4 +129,5 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
     boolean getPublicLb();
     boolean getEgressDefaultPolicy();
 
+    Integer getConcurrentConnections();
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f9c26ea/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 2c66299..14e1c96 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -517,6 +517,8 @@ public class ApiConstants {
     public static final String IS_DYNAMICALLY_SCALABLE = "isdynamicallyscalable";
     public static final String ROUTING = "isrouting";
     public static final String SERVICE_STATE = "servicestate";
+    public static final String MAX_CONNECTIONS = "maxconnections";
+
     public enum HostDetails {
         all, capacity, events, stats, min;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f9c26ea/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
b/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
index 94e263c..bdad904 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
@@ -102,6 +102,9 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
     @Parameter(name=ApiConstants.EGRESS_DEFAULT_POLICY, type=CommandType.BOOLEAN, description="true
if default guest network egress policy is allow; false if default egress policy is deny")
     private Boolean egressDefaultPolicy;
 
+    @Parameter(name=ApiConstants.MAX_CONNECTIONS, type=CommandType.INTEGER, description="maximum
number of concurrent connections supported by the network offering")
+    private Integer maxConnections;
+
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -172,6 +175,10 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
         return egressDefaultPolicy;
     }
 
+    public Integer getMaxconnections() {
+        return maxConnections;
+    }
+
     public Map<String, List<String>> getServiceProviders() {
         Map<String, List<String>> serviceProviderMap = null;
         if (serviceProviderList != null && !serviceProviderList.isEmpty()) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f9c26ea/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
index ba685a9..c9c4c8a 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
@@ -57,6 +57,9 @@ public class UpdateNetworkOfferingCmd extends BaseCmd {
     @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="update state
for the network offering")
     private String state;
 
+    @Parameter(name=ApiConstants.MAX_CONNECTIONS, type=CommandType.INTEGER, description="maximum
number of concurrent connections supported by the network offering")
+    private Integer maxConnections;
+
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -85,6 +88,9 @@ public class UpdateNetworkOfferingCmd extends BaseCmd {
         return sortKey;
     }
 
+    public Integer getMaxconnections() {
+        return maxConnections;
+    }
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f9c26ea/core/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java b/core/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java
index 1c1fb91..ee29290 100644
--- a/core/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java
+++ b/core/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java
@@ -32,6 +32,7 @@ public class LoadBalancerConfigCommand extends NetworkElementCommand {
     public String lbStatsSrcCidrs = "0/0" ; /* TODO : currently there is no filtering based
on the source ip */
     public String lbStatsAuth = "admin1:AdMiN123";
     public String lbStatsUri = "/admin?stats";
+    public String maxconn ="";
     NicTO nic;
     Long vpcId;
 
@@ -43,13 +44,14 @@ public class LoadBalancerConfigCommand extends NetworkElementCommand {
     	this.vpcId = vpcId;
     }
 
-    public LoadBalancerConfigCommand(LoadBalancerTO[] loadBalancers,String PublicIp,String
GuestIp,String PrivateIp, NicTO nic, Long vpcId) {
+    public LoadBalancerConfigCommand(LoadBalancerTO[] loadBalancers,String PublicIp,String
GuestIp,String PrivateIp, NicTO nic, Long vpcId, String maxconn) {
     	this.loadBalancers = loadBalancers;
     	this.lbStatsPublicIP = PublicIp;
     	this.lbStatsPrivateIP = PrivateIp;
     	this.lbStatsGuestIP = GuestIp;
     	this.nic = nic;
     	this.vpcId = vpcId;
+        this.maxconn=maxconn;
     }
 
     public NicTO getNic() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f9c26ea/core/src/com/cloud/network/HAProxyConfigurator.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/network/HAProxyConfigurator.java b/core/src/com/cloud/network/HAProxyConfigurator.java
index 162571f..2309125 100644
--- a/core/src/com/cloud/network/HAProxyConfigurator.java
+++ b/core/src/com/cloud/network/HAProxyConfigurator.java
@@ -528,8 +528,9 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
     @Override
     public String[] generateConfiguration(LoadBalancerConfigCommand lbCmd)   {
         List<String> result = new ArrayList<String>();
-
-        result.addAll(Arrays.asList(globalSection));
+        List <String> gSection =  Arrays.asList(globalSection);
+        gSection.set(2,"\tmaxconn " + lbCmd.maxconn);
+        result.addAll(gSection);
         result.add(blankLine);
         result.addAll(Arrays.asList(defaultsSection));
         if (!lbCmd.lbStatsVisibility.equals("disabled")) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f9c26ea/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 f21136e..406d98a 100755
--- a/engine/schema/src/com/cloud/offerings/NetworkOfferingVO.java
+++ b/engine/schema/src/com/cloud/offerings/NetworkOfferingVO.java
@@ -133,6 +133,9 @@ public class NetworkOfferingVO implements NetworkOffering {
     @Column(name = "egress_default_policy")
     boolean egressdefaultpolicy;
 
+    @Column(name = "concurrent_connections")
+    Integer concurrent_connections;
+
     @Override
     public String getDisplayText() {
         return displayText;
@@ -429,4 +432,11 @@ public class NetworkOfferingVO implements NetworkOffering {
     public void setPublicLb(boolean publicLb) {
         this.publicLb = publicLb;
     }
+    public Integer getConcurrentConnections() {
+        return  this.concurrent_connections;
+    }
+
+    public void setConcurrentConnections(Integer concurrent_connections) {
+        this.concurrent_connections = concurrent_connections;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f9c26ea/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
index b21e8f9..c870622 100644
--- a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
+++ b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
@@ -304,8 +304,16 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO>
{
             lbs[i++] = lb; 
         }
 
+        NetworkOffering offering =_networkOfferingDao.findById(guestNetworkId);
+        String maxconn= null;
+        if (offering.getConcurrentConnections() == null) {
+            maxconn =  _configDao.getValue(Config.NetworkLBHaproxyMaxConn.key());
+        }
+        else {
+            maxconn = offering.getConcurrentConnections().toString();
+        }
         LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lbs,elbVm.getPublicIpAddress(),
-                _nicDao.getIpAddress(guestNetworkId, elbVm.getId()),elbVm.getPrivateIpAddress(),
null, null);
+                _nicDao.getIpAddress(guestNetworkId, elbVm.getId()),elbVm.getPrivateIpAddress(),
null, null, maxconn);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP,
                 elbVm.getPrivateIpAddress());
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f9c26ea/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
index c633d57..76507e9 100644
--- a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
+++ b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
@@ -496,9 +496,17 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
                 _ntwkModel.isSecurityGroupSupportedInNetwork(guestNetwork), 
                 _ntwkModel.getNetworkTag(internalLbVm.getHypervisorType(), guestNetwork));
 
-        LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lbs, guestNic.getIp4Address(),

+        NetworkOffering offering =_networkOfferingDao.findById(guestNetworkId);
+        String maxconn= null;
+        if (offering.getConcurrentConnections() == null) {
+            maxconn =  _configDao.getValue(Config.NetworkLBHaproxyMaxConn.key());
+        }
+        else {
+            maxconn = offering.getConcurrentConnections().toString();
+        }
+        LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lbs, guestNic.getIp4Address(),
                 guestNic.getIp4Address(), internalLbVm.getPrivateIpAddress(), 
-                _itMgr.toNicTO(guestNicProfile, internalLbVm.getHypervisorType()), internalLbVm.getVpcId());
+                _itMgr.toNicTO(guestNicProfile, internalLbVm.getHypervisorType()), internalLbVm.getVpcId(),
maxconn);
 
         cmd.lbStatsVisibility = _configDao.getValue(Config.NetworkLBHaproxyStatsVisbility.key());
         cmd.lbStatsUri = _configDao.getValue(Config.NetworkLBHaproxyStatsUri.key());
@@ -892,7 +900,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
             s_logger.debug("No lb rules to be applied for network " + network);
             return true;
         }
-        
+        s_logger.info("lb rules to be applied for network ");
         //only one internal lb vm is supported per ip address at this time
         if (internalLbVms == null || internalLbVms.isEmpty()) {
             throw new CloudRuntimeException("Can't apply the lb rules on network " + network
+ " as the list of internal lb vms is empty");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f9c26ea/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMManagerTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMManagerTest.java
b/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMManagerTest.java
index a19a82e..85cf87e 100644
--- a/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMManagerTest.java
+++ b/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMManagerTest.java
@@ -24,6 +24,9 @@ import java.util.List;
 
 import javax.inject.Inject;
 
+import com.cloud.offering.NetworkOffering;
+import com.cloud.offerings.NetworkOfferingVO;
+import com.cloud.offerings.dao.NetworkOfferingDao;
 import junit.framework.TestCase;
 
 import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO;
@@ -91,7 +94,7 @@ public class InternalLBVMManagerTest extends TestCase {
     @Inject NetworkModel _ntwkModel;
     @Inject VirtualMachineManager _itMgr;
     @Inject DataCenterDao _dcDao;
-    
+    @Inject NetworkOfferingDao _offeringDao;
     long validNtwkId = 1L;
     long invalidNtwkId = 2L;
     String requestedIp = "10.1.1.1";
@@ -153,7 +156,9 @@ public class InternalLBVMManagerTest extends TestCase {
         DataCenterVO dc = new DataCenterVO
                 (1L, null, null, null, null, null, null, null, null, null, NetworkType.Advanced,
null, null);
         Mockito.when(_dcDao.findById(Mockito.anyLong())).thenReturn(dc);
-        
+        NetworkOfferingVO networkOfferingVO = new NetworkOfferingVO();
+        networkOfferingVO.setConcurrentConnections(500);
+        Mockito.when(_offeringDao.findById(Mockito.anyLong())).thenReturn(networkOfferingVO);
         
         try {
             Mockito.when(_itMgr.expunge(Mockito.any(DomainRouterVO.class), Mockito.any(User.class),
Mockito.any(Account.class))).thenReturn(true);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f9c26ea/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index a1fbe88..ff484be 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -92,6 +92,7 @@ public enum Config {
 	NetworkLBHaproxyStatsUri("Network", ManagementServer.class, String.class, "network.loadbalancer.haproxy.stats.uri","/admin?stats","Load
Balancer(haproxy) uri.",null),
 	NetworkLBHaproxyStatsAuth("Secure", ManagementServer.class, String.class, "network.loadbalancer.haproxy.stats.auth","admin1:AdMiN123","Load
Balancer(haproxy) authetication string in the format username:password",null),
 	NetworkLBHaproxyStatsPort("Network", ManagementServer.class, String.class, "network.loadbalancer.haproxy.stats.port","8081","Load
Balancer(haproxy) stats port number.",null),
+    NetworkLBHaproxyMaxConn("Network", ManagementServer.class, Integer.class, "network.loadbalancer.haproxy.max.conn",
"4096", "Load Balancer(haproxy) maximum number of concurrent connections(global max)", null),
 	NetworkRouterRpFilter("Network", ManagementServer.class, Integer.class, "network.disable.rpfilter",
"true", "disable rp_filter on Domain Router VM public interfaces.", null),
 
 	GuestVlanBits("Network", ManagementServer.class, Integer.class, "guest.vlan.bits", "12",
"The number of bits to reserve for the VLAN identifier in the guest subnet.", null),

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f9c26ea/server/src/com/cloud/configuration/ConfigurationManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManager.java b/server/src/com/cloud/configuration/ConfigurationManager.java
index 1b99b63..e06488e 100755
--- a/server/src/com/cloud/configuration/ConfigurationManager.java
+++ b/server/src/com/cloud/configuration/ConfigurationManager.java
@@ -219,7 +219,7 @@ public interface ConfigurationManager extends ConfigurationService, Manager
{
 
     NetworkOfferingVO createNetworkOffering(String name, String displayText, TrafficType
trafficType, String tags, boolean specifyVlan, Availability availability, Integer networkRate,
Map<Service, Set<Provider>> serviceProviderMap,
             boolean isDefault, Network.GuestType type, boolean systemOnly, Long serviceOfferingId,
boolean conserveMode, Map<Service, Map<Capability, String>> serviceCapabilityMap,
-            boolean specifyIpRanges, boolean isPersistent, Map<NetworkOffering.Detail,String>
details, boolean egressDefaultPolicy);
+            boolean specifyIpRanges, boolean isPersistent, Map<NetworkOffering.Detail,String>
details, boolean egressDefaultPolicy, Integer maxconn);
 
     Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetworkId,
boolean forVirtualNetwork, Long podId, String startIP, String endIP, String vlanGateway, String
vlanNetmask, String vlanId, Account vlanOwner, String startIPv6, String endIPv6, String vlanIp6Gateway,
String vlanIp6Cidr) throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f9c26ea/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 4c802b9..deebafa 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -3770,6 +3770,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements
Configurati
         boolean isPersistent = cmd.getIsPersistent();
         Map<String, String> detailsStr = cmd.getDetails();
         Boolean egressDefaultPolicy = cmd.getEgressDefaultPolicy();
+        Integer maxconn = null;
 
         // Verify traffic type
         for (TrafficType tType : TrafficType.values()) {
@@ -3924,7 +3925,14 @@ public class ConfigurationManagerImpl extends ManagerBase implements
Configurati
                     "Capabilities for LB service can be specifed only when LB service is
enabled for network offering.");
         }
         validateLoadBalancerServiceCapabilities(lbServiceCapabilityMap);
-
+        
+        if (lbServiceCapabilityMap != null && !lbServiceCapabilityMap.isEmpty())
{
+            maxconn = cmd.getMaxconnections();
+            if (maxconn == null) {
+                maxconn=Integer.parseInt(_configDao.getValue(Config.NetworkLBHaproxyMaxConn.key()));
+            }
+        }
+        
         // validate the Source NAT service capabilities specified in the network
         // offering
         Map<Capability, String> sourceNatServiceCapabilityMap = cmd.getServiceCapabilities(Service.SourceNat);
@@ -3981,7 +3989,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements
Configurati
 
         return createNetworkOffering(name, displayText, trafficType, tags, specifyVlan, availability,
networkRate,
                 serviceProviderMap, false, guestType, false, serviceOfferingId, conserveMode,
serviceCapabilityMap,
-                specifyIpRanges, isPersistent, details, egressDefaultPolicy);
+                specifyIpRanges, isPersistent, details, egressDefaultPolicy, maxconn);
     }
 
     void validateLoadBalancerServiceCapabilities(Map<Capability, String> lbServiceCapabilityMap)
{
@@ -4116,7 +4124,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements
Configurati
             Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault,
Network.GuestType type,
             boolean systemOnly, Long serviceOfferingId, boolean conserveMode,
             Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean
specifyIpRanges, boolean isPersistent,
-            Map<NetworkOffering.Detail, String> details, boolean egressDefaultPolicy)
{
+            Map<NetworkOffering.Detail, String> details, boolean egressDefaultPolicy,
Integer maxconn) {
 
         String multicastRateStr = _configDao.getValue("multicast.throttling.rate");
         int multicastRate = ((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr));
@@ -4274,6 +4282,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements
Configurati
         txn.start();
         // 1) create network offering object
         s_logger.debug("Adding network offering " + offering);
+        offering.setConcurrentConnections(maxconn);
         offering = _networkOfferingDao.persist(offering, details);
         // 2) populate services and providers
         if (serviceProviderMap != null) {
@@ -4635,6 +4644,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements
Configurati
         String name = cmd.getNetworkOfferingName();
         String availabilityStr = cmd.getAvailability();
         Integer sortKey = cmd.getSortKey();
+        Integer maxconn = cmd.getMaxconnections();
         Availability availability = null;
         String state = cmd.getState();
         UserContext.current().setEventDetails(" Id: " + id);
@@ -4709,6 +4719,10 @@ public class ConfigurationManagerImpl extends ManagerBase implements
Configurati
             }
         }
 
+        if (maxconn != null) {
+            offering.setConcurrentConnections(maxconn);
+        }
+
         if (_networkOfferingDao.update(id, offering)) {
             return _networkOfferingDao.findById(id);
         } else {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f9c26ea/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 187717a..f77955e 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -1341,7 +1341,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager,
L
                     _configMgr.createNetworkOffering(NetworkOffering.QuickCloudNoServices,
                             "Offering for QuickCloud with no services", TrafficType.Guest,
null, true,
                             Availability.Optional, null, new HashMap<Network.Service,
Set<Network.Provider>>(), true,
-                            Network.GuestType.Shared, false, null, true, null, true, false,
null, false);
+                            Network.GuestType.Shared, false, null, true, null, true, false,
null, false, null);
             offering.setState(NetworkOffering.State.Enabled);
             _networkOfferingDao.update(offering.getId(), offering);
         }
@@ -1352,7 +1352,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager,
L
                     _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOfferingWithSGService,
                             "Offering for Shared Security group enabled networks", TrafficType.Guest,
null, true,
                             Availability.Optional, null, defaultSharedNetworkOfferingProviders,
true,
-                            Network.GuestType.Shared, false, null, true, null, true, false,
null, false);
+                            Network.GuestType.Shared, false, null, true, null, true, false,
null, false, null);
             offering.setState(NetworkOffering.State.Enabled);
             _networkOfferingDao.update(offering.getId(), offering);
         }
@@ -1360,7 +1360,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager,
L
         //#3 - shared network offering with no SG service
         if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOffering)
== null) {
             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOffering,
"Offering for Shared networks", TrafficType.Guest, null, true, Availability.Optional, null,
-                    defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared,
false, null, true, null, true, false, null, false);
+                    defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared,
false, null, true, null, true, false, null, false, null);
             offering.setState(NetworkOffering.State.Enabled);
             _networkOfferingDao.update(offering.getId(), offering);
         }
@@ -1371,7 +1371,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager,
L
             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService,
                     "Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest,
                     null, false, Availability.Required, null, defaultIsolatedSourceNatEnabledNetworkOfferingProviders,
-                    true, Network.GuestType.Isolated, false, null, true, null, false, false,
null, false);
+                    true, Network.GuestType.Isolated, false, null, true, null, false, false,
null, false, null);
 
             offering.setState(NetworkOffering.State.Enabled);
             _networkOfferingDao.update(offering.getId(), offering);
@@ -1382,7 +1382,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager,
L
             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks,
                     "Offering for Isolated VPC networks with Source Nat service enabled",
TrafficType.Guest,
                     null, false, Availability.Optional, null, defaultVPCOffProviders,
-                    true, Network.GuestType.Isolated, false, null, false, null, false, false,
null,false);
+                    true, Network.GuestType.Isolated, false, null, false, null, false, false,
null,false, null);
             offering.setState(NetworkOffering.State.Enabled);
             _networkOfferingDao.update(offering.getId(), offering);
         }
@@ -1394,7 +1394,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager,
L
             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksNoLB,
                     "Offering for Isolated VPC networks with Source Nat service enabled and
LB service disabled", TrafficType.Guest,
                     null, false, Availability.Optional, null, defaultVPCOffProviders,
-                    true, Network.GuestType.Isolated, false, null, false, null, false, false,
null, false);
+                    true, Network.GuestType.Isolated, false, null, false, null, false, false,
null, false, null);
             offering.setState(NetworkOffering.State.Enabled);
             _networkOfferingDao.update(offering.getId(), offering);
         }
@@ -1404,7 +1404,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager,
L
             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOffering,
                     "Offering for Isolated networks with no Source Nat service", TrafficType.Guest,
null, true,
                     Availability.Optional, null, defaultIsolatedNetworkOfferingProviders,
true, Network.GuestType.Isolated,
-                    false, null, true, null, true, false, null, false);
+                    false, null, true, null, true, false, null, false, null);
             offering.setState(NetworkOffering.State.Enabled);
             _networkOfferingDao.update(offering.getId(), offering);
         }
@@ -1430,7 +1430,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager,
L
             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB,
                     "Offering for Isolated VPC networks with Internal Lb support", TrafficType.Guest,
                     null, false, Availability.Optional, null, internalLbOffProviders,
-                    true, Network.GuestType.Isolated, false, null, false, null, false, false,
null, false);
+                    true, Network.GuestType.Isolated, false, null, false, null, false, false,
null, false, null);
             offering.setState(NetworkOffering.State.Enabled);
             offering.setInternalLb(true);
             offering.setPublicLb(false);
@@ -1461,7 +1461,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager,
L
 
         if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedEIPandELBNetworkOffering)
== null) {
             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedEIPandELBNetworkOffering,
"Offering for Shared networks with Elastic IP and Elastic LB capabilities", TrafficType.Guest,
null, true,
-                    Availability.Optional, null, netscalerServiceProviders, true, Network.GuestType.Shared,
false, null, true, serviceCapabilityMap, true, false, null, false);
+                    Availability.Optional, null, netscalerServiceProviders, true, Network.GuestType.Shared,
false, null, true, serviceCapabilityMap, true, false, null, false, null);
             offering.setState(NetworkOffering.State.Enabled);
             offering.setDedicatedLB(false);
             _networkOfferingDao.update(offering.getId(), offering);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f9c26ea/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index c449f36..2a8a6e2 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -3312,10 +3312,17 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase
implements V
                 _networkModel.getNetworkRate(guestNetwork.getId(), router.getId()), 
                 _networkModel.isSecurityGroupSupportedInNetwork(guestNetwork), 
                 _networkModel.getNetworkTag(router.getHypervisorType(), guestNetwork));
-
-        LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lbs,routerPublicIp,

-                getRouterIpInNetwork(guestNetworkId, router.getId()),router.getPrivateIpAddress(),

-                _itMgr.toNicTO(nicProfile, router.getHypervisorType()), router.getVpcId());
+        NetworkOffering offering =_networkOfferingDao.findById(guestNetwork.getNetworkOfferingId());
+        String maxconn= null;
+        if (offering.getConcurrentConnections() == null) {
+            maxconn =  _configDao.getValue(Config.NetworkLBHaproxyMaxConn.key());
+        }
+        else {
+            maxconn = offering.getConcurrentConnections().toString();
+        }
+        LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lbs, routerPublicIp,
+                getRouterIpInNetwork(guestNetworkId, router.getId()), router.getPrivateIpAddress(),
+                _itMgr.toNicTO(nicProfile, router.getHypervisorType()), router.getVpcId(),
maxconn);
 
         cmd.lbStatsVisibility = _configDao.getValue(Config.NetworkLBHaproxyStatsVisbility.key());
         cmd.lbStatsUri = _configDao.getValue(Config.NetworkLBHaproxyStatsUri.key());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f9c26ea/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
index 7a61978..80b9e23 100755
--- a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
@@ -555,7 +555,7 @@ public class MockConfigurationManagerImpl extends ManagerBase implements
Configu
     @Override
     public NetworkOfferingVO createNetworkOffering(String name, String displayText, TrafficType
trafficType, String tags, boolean specifyVlan, Availability availability, Integer networkRate,
             Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault,
GuestType type, boolean systemOnly, Long serviceOfferingId, boolean conserveMode,
-            Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean
specifyIpRanges, boolean isPersistent, Map<NetworkOffering.Detail,String> details, boolean
egressDefaultPolicy) {
+            Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean
specifyIpRanges, boolean isPersistent, Map<NetworkOffering.Detail,String> details, boolean
egressDefaultPolicy, Integer maxconn) {
         // TODO Auto-generated method stub
         return null;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f9c26ea/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
----------------------------------------------------------------------
diff --git a/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
b/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
index 36564d9..508db03 100644
--- a/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
+++ b/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
@@ -94,7 +94,7 @@ public class CreateNetworkOfferingTest extends TestCase{
     public void createSharedNtwkOffWithVlan() {
         NetworkOfferingVO off = configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest,
null, true,
                 Availability.Optional, 200, null, false, Network.GuestType.Shared, false,
-                null, false, null, true, false, null, false);
+                null, false, null, true, false, null, false, null);
         assertNotNull("Shared network offering with specifyVlan=true failed to create ",
off);
     }
     
@@ -103,7 +103,7 @@ public class CreateNetworkOfferingTest extends TestCase{
         try {
             NetworkOfferingVO off = configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest,
null, false,
                     Availability.Optional, 200, null, false, Network.GuestType.Shared, false,
-                    null, false, null, true, false, null, false);
+                    null, false, null, true, false, null, false, null);
             assertNull("Shared network offering with specifyVlan=false was created", off);
         } catch (InvalidParameterValueException ex) {
         }
@@ -113,7 +113,7 @@ public class CreateNetworkOfferingTest extends TestCase{
     public void createSharedNtwkOffWithSpecifyIpRanges() {
         NetworkOfferingVO off = configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest,
null, true,
                 Availability.Optional, 200, null, false, Network.GuestType.Shared, false,
-                null, false, null, true, false, null, false);
+                null, false, null, true, false, null, false, null);
         
         assertNotNull("Shared network offering with specifyIpRanges=true failed to create
", off);
     }
@@ -123,7 +123,7 @@ public class CreateNetworkOfferingTest extends TestCase{
         try {
             NetworkOfferingVO off = configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest,
null, true,
                     Availability.Optional, 200, null, false, Network.GuestType.Shared, false,
-                    null, false, null, false, false, null, false);
+                    null, false, null, false, false, null, false, null);
             assertNull("Shared network offering with specifyIpRanges=false was created",
off);
         } catch (InvalidParameterValueException ex) {
         }
@@ -138,7 +138,7 @@ public class CreateNetworkOfferingTest extends TestCase{
         serviceProviderMap.put(Network.Service.SourceNat, vrProvider);
         NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest,
null, false,
                 Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated,
false,
-                null, false, null, false, false, null, false);
+                null, false, null, false, false, null, false, null);
         
         assertNotNull("Isolated network offering with specifyIpRanges=false failed to create
", off);
     }
@@ -151,7 +151,7 @@ public class CreateNetworkOfferingTest extends TestCase{
         serviceProviderMap.put(Network.Service.SourceNat, vrProvider);
         NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest,
null, true,
                 Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated,
false,
-                null, false, null, false, false, null, false);
+                null, false, null, false, false, null, false, null);
         assertNotNull("Isolated network offering with specifyVlan=true wasn't created", off);
        
     }
@@ -165,7 +165,7 @@ public class CreateNetworkOfferingTest extends TestCase{
             serviceProviderMap.put(Network.Service.SourceNat, vrProvider);
             NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated",
TrafficType.Guest, null, false,
                     Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated,
false,
-                    null, false, null, true, false, null, false);
+                    null, false, null, true, false, null, false, null);
             assertNull("Isolated network offering with specifyIpRanges=true and source nat
service enabled, was created", off);
         } catch (InvalidParameterValueException ex) {
         }
@@ -178,7 +178,7 @@ public class CreateNetworkOfferingTest extends TestCase{
         Set<Network.Provider> vrProvider = new HashSet<Network.Provider>();
         NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest,
null, false,
                 Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated,
false,
-                null, false, null, true, false, null, false);
+                null, false, null, true, false, null, false, null);
         assertNotNull("Isolated network offering with specifyIpRanges=true and with no sourceNatService,
failed to create", off);
         
     }
@@ -196,7 +196,7 @@ public class CreateNetworkOfferingTest extends TestCase{
         serviceProviderMap.put(Network.Service.Lb , vrProvider);
         NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest,
null, true,
                 Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated,
false,
-                null, false, null, false, false, null, false);
+                null, false, null, false, false, null, false, null);
         // System.out.println("Creating Vpc Network Offering");
         assertNotNull("Vpc Isolated network offering with Vpc provider ", off);
     }
@@ -216,7 +216,7 @@ public class CreateNetworkOfferingTest extends TestCase{
         serviceProviderMap.put(Network.Service.Lb, lbProvider);
         NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest,
null, true,
                 Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated,
false, null, false,
-                null, false, false, null, false);
+                null, false, false, null, false, null);
         // System.out.println("Creating Vpc Network Offering");
         assertNotNull("Vpc Isolated network offering with Vpc and Netscaler provider ", off);
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f9c26ea/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index 26ef964..8446e0f 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -2189,3 +2189,6 @@ ALTER TABLE `cloud`.`usage_event` ADD COLUMN `virtual_size` bigint unsigned;
 ALTER TABLE `cloud_usage`.`usage_event` ADD COLUMN `virtual_size` bigint unsigned;
 ALTER TABLE `cloud_usage`.`usage_storage` ADD COLUMN `virtual_size` bigint unsigned;
 ALTER TABLE `cloud_usage`.`cloud_usage` ADD COLUMN `virtual_size` bigint unsigned;
+INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'management-server',
'network.loadbalancer.haproxy.max.conn', '4096', 'Load Balancer(haproxy) maximum number of
concurrent connections(global max)');
+
+ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `concurrent_connections` int(10) unsigned
COMMENT 'Load Balancer(haproxy) maximum number of concurrent connections(global max)';


Mime
View raw message