Cloudstack-2997 Make haproxy maxconn configurable

Signed-off-by: Abhinandan Prateek <aprateek@apache.org>
This commit is contained in:
Bharat Kumar 2013-06-25 18:13:31 +05:30 committed by Abhinandan Prateek
parent 6b549074fa
commit dd33abffbe
18 changed files with 110 additions and 36 deletions

View File

@ -129,4 +129,5 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
boolean getPublicLb(); boolean getPublicLb();
boolean getEgressDefaultPolicy(); boolean getEgressDefaultPolicy();
Integer getConcurrentConnections();
} }

View File

@ -518,6 +518,7 @@ public class ApiConstants {
public static final String NUMBER = "number"; public static final String NUMBER = "number";
public static final String IS_DYNAMICALLY_SCALABLE = "isdynamicallyscalable"; public static final String IS_DYNAMICALLY_SCALABLE = "isdynamicallyscalable";
public static final String ROUTING = "isrouting"; public static final String ROUTING = "isrouting";
public static final String MAX_CONNECTIONS = "maxconnections";
public enum HostDetails { public enum HostDetails {
all, capacity, events, stats, min; all, capacity, events, stats, min;

View File

@ -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") @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; 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 /////////////////////// /////////////////// Accessors ///////////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
@ -172,6 +175,10 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
return egressDefaultPolicy; return egressDefaultPolicy;
} }
public Integer getMaxconnections() {
return maxConnections;
}
public Map<String, List<String>> getServiceProviders() { public Map<String, List<String>> getServiceProviders() {
Map<String, List<String>> serviceProviderMap = null; Map<String, List<String>> serviceProviderMap = null;
if (serviceProviderList != null && !serviceProviderList.isEmpty()) { if (serviceProviderList != null && !serviceProviderList.isEmpty()) {

View File

@ -57,6 +57,9 @@ public class UpdateNetworkOfferingCmd extends BaseCmd {
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="update state for the network offering") @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="update state for the network offering")
private String state; 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 /////////////////////// /////////////////// Accessors ///////////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
@ -85,6 +88,9 @@ public class UpdateNetworkOfferingCmd extends BaseCmd {
return sortKey; return sortKey;
} }
public Integer getMaxconnections() {
return maxConnections;
}
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
/////////////// API Implementation/////////////////// /////////////// API Implementation///////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////

View File

@ -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 lbStatsSrcCidrs = "0/0" ; /* TODO : currently there is no filtering based on the source ip */
public String lbStatsAuth = "admin1:AdMiN123"; public String lbStatsAuth = "admin1:AdMiN123";
public String lbStatsUri = "/admin?stats"; public String lbStatsUri = "/admin?stats";
public String maxconn ="";
NicTO nic; NicTO nic;
Long vpcId; Long vpcId;
@ -43,13 +44,14 @@ public class LoadBalancerConfigCommand extends NetworkElementCommand {
this.vpcId = vpcId; 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.loadBalancers = loadBalancers;
this.lbStatsPublicIP = PublicIp; this.lbStatsPublicIP = PublicIp;
this.lbStatsPrivateIP = PrivateIp; this.lbStatsPrivateIP = PrivateIp;
this.lbStatsGuestIP = GuestIp; this.lbStatsGuestIP = GuestIp;
this.nic = nic; this.nic = nic;
this.vpcId = vpcId; this.vpcId = vpcId;
this.maxconn=maxconn;
} }
public NicTO getNic() { public NicTO getNic() {

View File

@ -528,8 +528,9 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
@Override @Override
public String[] generateConfiguration(LoadBalancerConfigCommand lbCmd) { public String[] generateConfiguration(LoadBalancerConfigCommand lbCmd) {
List<String> result = new ArrayList<String>(); List<String> result = new ArrayList<String>();
List <String> gSection = Arrays.asList(globalSection);
result.addAll(Arrays.asList(globalSection)); gSection.set(2,"\tmaxconn " + lbCmd.maxconn);
result.addAll(gSection);
result.add(blankLine); result.add(blankLine);
result.addAll(Arrays.asList(defaultsSection)); result.addAll(Arrays.asList(defaultsSection));
if (!lbCmd.lbStatsVisibility.equals("disabled")) { if (!lbCmd.lbStatsVisibility.equals("disabled")) {

View File

@ -133,6 +133,9 @@ public class NetworkOfferingVO implements NetworkOffering {
@Column(name = "egress_default_policy") @Column(name = "egress_default_policy")
boolean egressdefaultpolicy; boolean egressdefaultpolicy;
@Column(name = "concurrent_connections")
Integer concurrent_connections;
@Override @Override
public String getDisplayText() { public String getDisplayText() {
return displayText; return displayText;
@ -426,4 +429,11 @@ public class NetworkOfferingVO implements NetworkOffering {
this.internalLb = internalLb; this.internalLb = internalLb;
} }
public Integer getConcurrentConnections() {
return this.concurrent_connections;
}
public void setConcurrentConnections(Integer concurrent_connections) {
this.concurrent_connections = concurrent_connections;
}
} }

View File

@ -303,8 +303,16 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
lbs[i++] = lb; 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(), 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, cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP,
elbVm.getPrivateIpAddress()); elbVm.getPrivateIpAddress());
cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME,

View File

@ -482,9 +482,17 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
_ntwkModel.isSecurityGroupSupportedInNetwork(guestNetwork), _ntwkModel.isSecurityGroupSupportedInNetwork(guestNetwork),
_ntwkModel.getNetworkTag(internalLbVm.getHypervisorType(), 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(), 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.lbStatsVisibility = _configDao.getValue(Config.NetworkLBHaproxyStatsVisbility.key());
cmd.lbStatsUri = _configDao.getValue(Config.NetworkLBHaproxyStatsUri.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); s_logger.debug("No lb rules to be applied for network " + network);
return true; 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 //only one internal lb vm is supported per ip address at this time
if (internalLbVms == null || internalLbVms.isEmpty()) { 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"); throw new CloudRuntimeException("Can't apply the lb rules on network " + network + " as the list of internal lb vms is empty");

View File

@ -24,6 +24,9 @@ import java.util.List;
import javax.inject.Inject; 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 junit.framework.TestCase;
import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO; import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO;
@ -91,7 +94,7 @@ public class InternalLBVMManagerTest extends TestCase {
@Inject NetworkModel _ntwkModel; @Inject NetworkModel _ntwkModel;
@Inject VirtualMachineManager _itMgr; @Inject VirtualMachineManager _itMgr;
@Inject DataCenterDao _dcDao; @Inject DataCenterDao _dcDao;
@Inject NetworkOfferingDao _offeringDao;
long validNtwkId = 1L; long validNtwkId = 1L;
long invalidNtwkId = 2L; long invalidNtwkId = 2L;
String requestedIp = "10.1.1.1"; String requestedIp = "10.1.1.1";
@ -153,7 +156,9 @@ public class InternalLBVMManagerTest extends TestCase {
DataCenterVO dc = new DataCenterVO DataCenterVO dc = new DataCenterVO
(1L, null, null, null, null, null, null, null, null, null, NetworkType.Advanced, null, null); (1L, null, null, null, null, null, null, null, null, null, NetworkType.Advanced, null, null);
Mockito.when(_dcDao.findById(Mockito.anyLong())).thenReturn(dc); Mockito.when(_dcDao.findById(Mockito.anyLong())).thenReturn(dc);
NetworkOfferingVO networkOfferingVO = new NetworkOfferingVO();
networkOfferingVO.setConcurrentConnections(500);
Mockito.when(_offeringDao.findById(Mockito.anyLong())).thenReturn(networkOfferingVO);
try { try {
Mockito.when(_itMgr.expunge(Mockito.any(DomainRouterVO.class), Mockito.any(User.class), Mockito.any(Account.class))).thenReturn(true); Mockito.when(_itMgr.expunge(Mockito.any(DomainRouterVO.class), Mockito.any(User.class), Mockito.any(Account.class))).thenReturn(true);

View File

@ -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), 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), 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), 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), 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), 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),

View File

@ -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, 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 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; 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;

View File

@ -3827,6 +3827,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
boolean isPersistent = cmd.getIsPersistent(); boolean isPersistent = cmd.getIsPersistent();
Map<String, String> detailsStr = cmd.getDetails(); Map<String, String> detailsStr = cmd.getDetails();
Boolean egressDefaultPolicy = cmd.getEgressDefaultPolicy(); Boolean egressDefaultPolicy = cmd.getEgressDefaultPolicy();
Integer maxconn = null;
// Verify traffic type // Verify traffic type
for (TrafficType tType : TrafficType.values()) { 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."); "Capabilities for LB service can be specifed only when LB service is enabled for network offering.");
} }
validateLoadBalancerServiceCapabilities(lbServiceCapabilityMap); 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 // validate the Source NAT service capabilities specified in the network
// offering // offering
Map<Capability, String> sourceNatServiceCapabilityMap = cmd.getServiceCapabilities(Service.SourceNat); 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, Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, Network.GuestType type,
boolean systemOnly, Long serviceOfferingId, boolean conserveMode, boolean systemOnly, Long serviceOfferingId, boolean conserveMode,
Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean specifyIpRanges, boolean isPersistent, 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"); String multicastRateStr = _configDao.getValue("multicast.throttling.rate");
int multicastRate = ((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr)); int multicastRate = ((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr));
@ -4334,6 +4342,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
txn.start(); txn.start();
// 1) create network offering object // 1) create network offering object
s_logger.debug("Adding network offering " + offering); s_logger.debug("Adding network offering " + offering);
offering.setConcurrentConnections(maxconn);
offering = _networkOfferingDao.persist(offering, details); offering = _networkOfferingDao.persist(offering, details);
// 2) populate services and providers // 2) populate services and providers
if (serviceProviderMap != null) { if (serviceProviderMap != null) {
@ -4694,6 +4703,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
String name = cmd.getNetworkOfferingName(); String name = cmd.getNetworkOfferingName();
String availabilityStr = cmd.getAvailability(); String availabilityStr = cmd.getAvailability();
Integer sortKey = cmd.getSortKey(); Integer sortKey = cmd.getSortKey();
Integer maxconn = cmd.getMaxconnections();
Availability availability = null; Availability availability = null;
String state = cmd.getState(); String state = cmd.getState();
CallContext.current().setEventDetails(" Id: " + id); 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)) { if (_networkOfferingDao.update(id, offering)) {
return _networkOfferingDao.findById(id); return _networkOfferingDao.findById(id);
} else { } else {

View File

@ -1336,7 +1336,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
_configMgr.createNetworkOffering(NetworkOffering.QuickCloudNoServices, _configMgr.createNetworkOffering(NetworkOffering.QuickCloudNoServices,
"Offering for QuickCloud with no services", TrafficType.Guest, null, true, "Offering for QuickCloud with no services", TrafficType.Guest, null, true,
Availability.Optional, null, new HashMap<Network.Service, Set<Network.Provider>>(), 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); offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering); _networkOfferingDao.update(offering.getId(), offering);
} }
@ -1347,7 +1347,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
_configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOfferingWithSGService, _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOfferingWithSGService,
"Offering for Shared Security group enabled networks", TrafficType.Guest, null, true, "Offering for Shared Security group enabled networks", TrafficType.Guest, null, true,
Availability.Optional, null, defaultSharedNetworkOfferingProviders, 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); offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering); _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 //#3 - shared network offering with no SG service
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOffering) == null) { if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOffering) == null) {
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, true, Availability.Optional, 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); offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering); _networkOfferingDao.update(offering.getId(), offering);
} }
@ -1366,7 +1366,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService, offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService,
"Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest, "Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest,
null, false, Availability.Required, null, defaultIsolatedSourceNatEnabledNetworkOfferingProviders, 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); offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering); _networkOfferingDao.update(offering.getId(), offering);
@ -1377,7 +1377,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks, offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks,
"Offering for Isolated VPC networks with Source Nat service enabled", TrafficType.Guest, "Offering for Isolated VPC networks with Source Nat service enabled", TrafficType.Guest,
null, false, Availability.Optional, null, defaultVPCOffProviders, 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); offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering); _networkOfferingDao.update(offering.getId(), offering);
} }
@ -1389,7 +1389,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksNoLB, offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksNoLB,
"Offering for Isolated VPC networks with Source Nat service enabled and LB service disabled", TrafficType.Guest, "Offering for Isolated VPC networks with Source Nat service enabled and LB service disabled", TrafficType.Guest,
null, false, Availability.Optional, null, defaultVPCOffProviders, 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); offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering); _networkOfferingDao.update(offering.getId(), offering);
} }
@ -1399,7 +1399,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOffering, offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOffering,
"Offering for Isolated networks with no Source Nat service", TrafficType.Guest, null, true, "Offering for Isolated networks with no Source Nat service", TrafficType.Guest, null, true,
Availability.Optional, null, defaultIsolatedNetworkOfferingProviders, true, Network.GuestType.Isolated, 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); offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering); _networkOfferingDao.update(offering.getId(), offering);
} }
@ -1425,7 +1425,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB, offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB,
"Offering for Isolated VPC networks with Internal Lb support", TrafficType.Guest, "Offering for Isolated VPC networks with Internal Lb support", TrafficType.Guest,
null, false, Availability.Optional, null, internalLbOffProviders, 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.setState(NetworkOffering.State.Enabled);
offering.setInternalLb(true); offering.setInternalLb(true);
_networkOfferingDao.update(offering.getId(), offering); _networkOfferingDao.update(offering.getId(), offering);
@ -1455,7 +1455,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedEIPandELBNetworkOffering) == null) { 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, 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.setState(NetworkOffering.State.Enabled);
offering.setDedicatedLB(false); offering.setDedicatedLB(false);
_networkOfferingDao.update(offering.getId(), offering); _networkOfferingDao.update(offering.getId(), offering);

View File

@ -3319,10 +3319,17 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
_networkModel.getNetworkRate(guestNetwork.getId(), router.getId()), _networkModel.getNetworkRate(guestNetwork.getId(), router.getId()),
_networkModel.isSecurityGroupSupportedInNetwork(guestNetwork), _networkModel.isSecurityGroupSupportedInNetwork(guestNetwork),
_networkModel.getNetworkTag(router.getHypervisorType(), guestNetwork)); _networkModel.getNetworkTag(router.getHypervisorType(), guestNetwork));
NetworkOffering offering =_networkOfferingDao.findById(guestNetwork.getNetworkOfferingId());
LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lbs,routerPublicIp, String maxconn= null;
getRouterIpInNetwork(guestNetworkId, router.getId()),router.getPrivateIpAddress(), if (offering.getConcurrentConnections() == null) {
_itMgr.toNicTO(nicProfile, router.getHypervisorType()), router.getVpcId()); 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.lbStatsVisibility = _configDao.getValue(Config.NetworkLBHaproxyStatsVisbility.key());
cmd.lbStatsUri = _configDao.getValue(Config.NetworkLBHaproxyStatsUri.key()); cmd.lbStatsUri = _configDao.getValue(Config.NetworkLBHaproxyStatsUri.key());

View File

@ -555,7 +555,7 @@ public class MockConfigurationManagerImpl extends ManagerBase implements Configu
@Override @Override
public NetworkOfferingVO createNetworkOffering(String name, String displayText, TrafficType trafficType, String tags, boolean specifyVlan, Availability availability, Integer networkRate, 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, 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 // TODO Auto-generated method stub
return null; return null;
} }

View File

@ -106,7 +106,7 @@ public class CreateNetworkOfferingTest extends TestCase{
public void createSharedNtwkOffWithVlan() { public void createSharedNtwkOffWithVlan() {
NetworkOfferingVO off = configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest, null, true, NetworkOfferingVO off = configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest, null, true,
Availability.Optional, 200, null, false, Network.GuestType.Shared, 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);
assertNotNull("Shared network offering with specifyVlan=true failed to create ", off); assertNotNull("Shared network offering with specifyVlan=true failed to create ", off);
} }
@ -115,7 +115,7 @@ public class CreateNetworkOfferingTest extends TestCase{
try { try {
NetworkOfferingVO off = configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest, null, false, NetworkOfferingVO off = configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest, null, false,
Availability.Optional, 200, null, false, Network.GuestType.Shared, 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); assertNull("Shared network offering with specifyVlan=false was created", off);
} catch (InvalidParameterValueException ex) { } catch (InvalidParameterValueException ex) {
} }
@ -125,7 +125,7 @@ public class CreateNetworkOfferingTest extends TestCase{
public void createSharedNtwkOffWithSpecifyIpRanges() { public void createSharedNtwkOffWithSpecifyIpRanges() {
NetworkOfferingVO off = configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest, null, true, NetworkOfferingVO off = configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest, null, true,
Availability.Optional, 200, null, false, Network.GuestType.Shared, 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);
assertNotNull("Shared network offering with specifyIpRanges=true failed to create ", off); assertNotNull("Shared network offering with specifyIpRanges=true failed to create ", off);
} }
@ -135,7 +135,7 @@ public class CreateNetworkOfferingTest extends TestCase{
try { try {
NetworkOfferingVO off = configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest, null, true, NetworkOfferingVO off = configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest, null, true,
Availability.Optional, 200, null, false, Network.GuestType.Shared, false, 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); assertNull("Shared network offering with specifyIpRanges=false was created", off);
} catch (InvalidParameterValueException ex) { } catch (InvalidParameterValueException ex) {
} }
@ -150,7 +150,7 @@ public class CreateNetworkOfferingTest extends TestCase{
serviceProviderMap.put(Network.Service.SourceNat, vrProvider); serviceProviderMap.put(Network.Service.SourceNat, vrProvider);
NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, false, NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, false,
Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated, 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); 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); serviceProviderMap.put(Network.Service.SourceNat, vrProvider);
NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true, NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true,
Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated, 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 specifyVlan=true wasn't created", off); 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); serviceProviderMap.put(Network.Service.SourceNat, vrProvider);
NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, false, NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, false,
Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated, 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); assertNull("Isolated network offering with specifyIpRanges=true and source nat service enabled, was created", off);
} catch (InvalidParameterValueException ex) { } catch (InvalidParameterValueException ex) {
} }
@ -190,7 +190,7 @@ public class CreateNetworkOfferingTest extends TestCase{
Set<Network.Provider> vrProvider = new HashSet<Network.Provider>(); Set<Network.Provider> vrProvider = new HashSet<Network.Provider>();
NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, false, NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, false,
Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated, 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); 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); serviceProviderMap.put(Network.Service.Lb , vrProvider);
NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true, NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true,
Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated, 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);
// System.out.println("Creating Vpc Network Offering"); // System.out.println("Creating Vpc Network Offering");
assertNotNull("Vpc Isolated network offering with Vpc provider ", off); assertNotNull("Vpc Isolated network offering with Vpc provider ", off);
} }
@ -228,7 +228,7 @@ public class CreateNetworkOfferingTest extends TestCase{
serviceProviderMap.put(Network.Service.Lb, lbProvider); serviceProviderMap.put(Network.Service.Lb, lbProvider);
NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true, NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true,
Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated, false, null, false, 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"); // System.out.println("Creating Vpc Network Offering");
assertNotNull("Vpc Isolated network offering with Vpc and Netscaler provider ", off); assertNotNull("Vpc Isolated network offering with Vpc and Netscaler provider ", off);
} }

View File

@ -2232,3 +2232,6 @@ CREATE VIEW `cloud`.`project_view` AS
and resource_tags.resource_type = 'Project' and resource_tags.resource_type = 'Project'
left join left join
`cloud`.`project_account` pacct ON projects.id = pacct.project_id; `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)';