cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aprat...@apache.org
Subject [2/3] git commit: updated refs/heads/master to 954e197
Date Wed, 17 Jul 2013 04:36:52 GMT
Cloudstack-2997 Make haproxy maxconn configurable

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


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

Branch: refs/heads/master
Commit: dd33abffbe3b7c5b615e8f64b1824a720329dd0d
Parents: 6b54907
Author: Bharat Kumar <bharat.kumar@citrix.com>
Authored: Tue Jun 25 18:13:31 2013 +0530
Committer: Abhinandan Prateek <aprateek@apache.org>
Committed: Wed Jul 17 10:06:11 2013 +0530

----------------------------------------------------------------------
 api/src/com/cloud/offering/NetworkOffering.java |  1 +
 .../org/apache/cloudstack/api/ApiConstants.java |  1 +
 .../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 | 18 ++++++++++++++++--
 .../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, 110 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd33abff/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/dd33abff/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 83999b6..0550a39 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -518,6 +518,7 @@ public class ApiConstants {
     public static final String NUMBER = "number";
     public static final String IS_DYNAMICALLY_SCALABLE = "isdynamicallyscalable";
     public static final String ROUTING = "isrouting";
+    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/dd33abff/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/dd33abff/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/dd33abff/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/dd33abff/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/dd33abff/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 6317f72..f8f25ea 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;
@@ -426,4 +429,11 @@ public class NetworkOfferingVO implements NetworkOffering {
         this.internalLb = internalLb;
     }
 
+    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/dd33abff/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 9c34a8b..3e2cbbe 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
@@ -303,8 +303,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/dd33abff/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 5d6a671..e027ec3 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
@@ -482,9 +482,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());
@@ -878,7 +886,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/dd33abff/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/dd33abff/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 e77f6ce..bb0237c 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/dd33abff/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/dd33abff/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 bdb5260..9498c82 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -3827,6 +3827,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()) {
@@ -3981,7 +3982,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);
@@ -4176,7 +4184,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));
@@ -4334,6 +4342,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) {
@@ -4694,6 +4703,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();
         CallContext.current().setEventDetails(" Id: " + id);
@@ -4768,6 +4778,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/dd33abff/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 0e80119..db375c3 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -1336,7 +1336,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);
         }
@@ -1347,7 +1347,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);
         }
@@ -1355,7 +1355,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);
         }
@@ -1366,7 +1366,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);
@@ -1377,7 +1377,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);
         }
@@ -1389,7 +1389,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);
         }
@@ -1399,7 +1399,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);
         }
@@ -1425,7 +1425,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);
             _networkOfferingDao.update(offering.getId(), offering);
@@ -1455,7 +1455,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/dd33abff/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 0a67cff..e437af6 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -3319,10 +3319,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/dd33abff/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/dd33abff/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 9825cab..5527031 100644
--- a/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
+++ b/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
@@ -106,7 +106,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);
     }
     
@@ -115,7 +115,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) {
         }
@@ -125,7 +125,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);
     }
@@ -135,7 +135,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) {
         }
@@ -150,7 +150,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);
     }
@@ -163,7 +163,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);
        
     }
@@ -177,7 +177,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) {
         }
@@ -190,7 +190,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);
         
     }
@@ -208,7 +208,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);
     }
@@ -228,7 +228,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/dd33abff/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index e9fa995..fe1426e 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -2232,3 +2232,6 @@ CREATE VIEW `cloud`.`project_view` AS
             and resource_tags.resource_type = 'Project'
             left join
         `cloud`.`project_account` pacct ON projects.id = pacct.project_id;
+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