diff --git a/api/src/com/cloud/api/ApiConstants.java b/api/src/com/cloud/api/ApiConstants.java index be644ad81dd..2506a4cb19b 100755 --- a/api/src/com/cloud/api/ApiConstants.java +++ b/api/src/com/cloud/api/ApiConstants.java @@ -274,6 +274,7 @@ public class ApiConstants { public static final String FIREWALL_SERVICE = "firewallservice"; public static final String GATEWAY_SERVICE = "gatewayservice"; public static final String SERVICE_PROVIDER_LIST = "serviceproviderlist"; + public static final String SERVICE_CAPABILITY_LIST = "servicecapabilitylist"; public static final String PROVIDER = "provider"; public static final String NETWORK_SPEED = "networkspeed"; public static final String BROADCAST_DOMAIN_RANGE = "broadcastdomainrange"; diff --git a/api/src/com/cloud/api/commands/CreateNetworkOfferingCmd.java b/api/src/com/cloud/api/commands/CreateNetworkOfferingCmd.java index 6d4519980a9..e3218d75bd1 100644 --- a/api/src/com/cloud/api/commands/CreateNetworkOfferingCmd.java +++ b/api/src/com/cloud/api/commands/CreateNetworkOfferingCmd.java @@ -33,6 +33,8 @@ import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.api.response.NetworkOfferingResponse; +import com.cloud.network.Network.Capability; +import com.cloud.network.Network.Service; import com.cloud.offering.NetworkOffering; import com.cloud.offering.NetworkOffering.Availability; import com.cloud.user.Account; @@ -112,6 +114,9 @@ public class CreateNetworkOfferingCmd extends BaseCmd { @Parameter(name = ApiConstants.SERVICE_PROVIDER_LIST, type = CommandType.MAP, description = "provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network") private Map serviceProviderList; + @Parameter(name = ApiConstants.SERVICE_CAPABILITY_LIST, type = CommandType.MAP, description = "desired service capabilities as part of network offering") + private Map serviceCapabilistList; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -232,6 +237,17 @@ public class CreateNetworkOfferingCmd extends BaseCmd { return serviceProviderMap; } + public Map getServiceCapabilities(Service service) { + + Map serviceCapabilityMap = null; + if (serviceCapabilistList != null && !serviceCapabilistList.isEmpty()) { + if (serviceCapabilistList.containsKey(service.getName())) { + serviceCapabilityMap = (HashMap) serviceCapabilistList.get(service.getName()); + } + } + return serviceCapabilityMap; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java b/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java index 873b71c115e..688c419ab66 100644 --- a/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java +++ b/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java @@ -33,6 +33,8 @@ import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.api.response.NetworkOfferingResponse; +import com.cloud.network.Network.Capability; +import com.cloud.network.Network.Service; import com.cloud.offering.NetworkOffering; import com.cloud.user.Account; @@ -92,7 +94,10 @@ public class UpdateNetworkOfferingCmd extends BaseCmd { @Parameter(name = ApiConstants.SERVICE_PROVIDER_LIST, type = CommandType.MAP, description = "provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network") private Map serviceProviderList; - + + @Parameter(name = ApiConstants.SERVICE_CAPABILITY_LIST, type = CommandType.MAP, description = "desired service capabilities as part of network offering") + private Map serviceCapabilistList; + @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="update state for the network offering") private String state; @@ -184,6 +189,18 @@ public class UpdateNetworkOfferingCmd extends BaseCmd { return serviceProviderMap; } + public Map getServiceCapabilities(Service service) { + + Map serviceCapabilityMap = null; + if (serviceCapabilistList != null && !serviceCapabilistList.isEmpty()) { + if (serviceCapabilistList.containsKey(service.getName())) { + serviceCapabilityMap = (HashMap) serviceCapabilistList.get(service.getName()); + } + } + return serviceCapabilityMap; + } + + public String getState() { return state; } diff --git a/api/src/com/cloud/api/response/NetworkOfferingResponse.java b/api/src/com/cloud/api/response/NetworkOfferingResponse.java index 3766ba96efc..9451d4d5a82 100644 --- a/api/src/com/cloud/api/response/NetworkOfferingResponse.java +++ b/api/src/com/cloud/api/response/NetworkOfferingResponse.java @@ -68,7 +68,13 @@ public class NetworkOfferingResponse extends BaseResponse{ @SerializedName("service") @Param(description="the list of supported services", responseObject = ServiceResponse.class) private List services; - + + @SerializedName(ApiConstants.IS_SHARED) @Param(description="true if load balncer service offered is shared by multiple networks", responseObject = ServiceResponse.class) + private Boolean isLbShared; + + @SerializedName(ApiConstants.IS_SHARED) @Param(description="true if soruce NAT service offered is shared by multiple networks", responseObject = ServiceResponse.class) + private Boolean isSourceNatShared; + public void setId(Long id) { this.id = id; } @@ -128,4 +134,12 @@ public class NetworkOfferingResponse extends BaseResponse{ public void setGuestIpType(String type) { this.guestIpType = type; } + + public void setIsLBShared(boolean isLbSared) { + this.isLbShared = isLbSared; + } + + public void setIsSourceNatShared(boolean isSourceNatShared) { + this.isSourceNatShared = isSourceNatShared; + } } diff --git a/api/src/com/cloud/network/Network.java b/api/src/com/cloud/network/Network.java index 4fefdf0cdb8..f96b08b52b0 100644 --- a/api/src/com/cloud/network/Network.java +++ b/api/src/com/cloud/network/Network.java @@ -52,7 +52,7 @@ public interface Network extends ControlledEntity { public static final Service Dns = new Service("Dns", Capability.AllowDnsSuffixModification); public static final Service Gateway = new Service("Gateway"); public static final Service Firewall = new Service("Firewall", Capability.SupportedProtocols, Capability.MultipleIps, Capability.SupportedSourceNatTypes, Capability.TrafficStatistics); - public static final Service Lb = new Service("Lb", Capability.SupportedLBAlgorithms, Capability.SupportedProtocols, Capability.TrafficStatistics, Capability.LoadBalancingSupportedIps); + public static final Service Lb = new Service("Lb", Capability.SupportedLBAlgorithms, Capability.SupportedLBIsolation, Capability.SupportedProtocols, Capability.TrafficStatistics, Capability.LoadBalancingSupportedIps); public static final Service UserData = new Service("UserData"); public static final Service SourceNat = new Service("SourceNat"); public static final Service StaticNat = new Service("StaticNat"); @@ -156,6 +156,7 @@ public interface Network extends ControlledEntity { public static final Capability SupportedProtocols = new Capability("SupportedProtocols"); public static final Capability SupportedLBAlgorithms = new Capability("SupportedLbAlgorithms"); + public static final Capability SupportedLBIsolation = new Capability("SupportedLBIsolation"); public static final Capability MultipleIps = new Capability("MultipleIps"); public static final Capability SupportedSourceNatTypes = new Capability("SupportedSourceNatTypes"); public static final Capability SupportedVpnTypes = new Capability("SupportedVpnTypes"); diff --git a/api/src/com/cloud/offering/NetworkOffering.java b/api/src/com/cloud/offering/NetworkOffering.java index 764b3d0e4d3..375b479aa00 100644 --- a/api/src/com/cloud/offering/NetworkOffering.java +++ b/api/src/com/cloud/offering/NetworkOffering.java @@ -96,4 +96,8 @@ public interface NetworkOffering { GuestType getGuestType(); Long getServiceOfferingId(); + + boolean getDedicatedLB(); + + boolean getSharedSourceNat(); } diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index c0a9e270497..8c1900ff00f 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -2113,6 +2113,8 @@ public class ApiResponseHelper implements ResponseGenerator { response.setSpecifyVlan(offering.getSpecifyVlan()); response.setAvailability(offering.getAvailability().toString()); response.setNetworkRate(ApiDBUtils.getNetworkRate(offering.getId())); + response.setIsLBShared(!offering.getDedicatedLB()); + response.setIsSourceNatShared(offering.getSharedSourceNat()); if (offering.getGuestType() != null) { response.setGuestIpType(offering.getGuestType().toString()); } diff --git a/server/src/com/cloud/configuration/ConfigurationManager.java b/server/src/com/cloud/configuration/ConfigurationManager.java index e149ac1ae63..e41b64787b1 100644 --- a/server/src/com/cloud/configuration/ConfigurationManager.java +++ b/server/src/com/cloud/configuration/ConfigurationManager.java @@ -33,6 +33,7 @@ import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.PermissionDeniedException; import com.cloud.network.Network; +import com.cloud.network.Network.Capability; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; import com.cloud.network.Networks.TrafficType; @@ -186,8 +187,9 @@ public interface ConfigurationManager extends ConfigurationService, Manager { * @return network offering object */ - NetworkOfferingVO createNetworkOffering(long userId, String name, String displayText, TrafficType trafficType, String tags, Integer maxConnections, boolean specifyVlan, Availability availability, Integer networkRate, Map> serviceProviderMap, boolean isDefault, Network.GuestType type, boolean systemOnly, Long serviceOfferingId); - + NetworkOfferingVO createNetworkOffering(long userId, String name, String displayText, TrafficType trafficType, String tags, Integer maxConnections, boolean specifyVlan, Availability availability, Integer networkRate, Map> serviceProviderMap, boolean isDefault, Network.GuestType type, boolean systemOnly, Long serviceOfferingId, + Map lbServiceCapabilityMap, Map fwServiceCapabilityMap); + Vlan createVlanAndPublicIpRange(Long userId, Long zoneId, Long podId, String startIP, String endIP, String vlanGateway, String vlanNetmask, boolean forVirtualNetwork, String vlanId, Account account, Long networkId, Long physicalNetworkId) throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException; void createDefaultNetworks(long zoneId, boolean isSecurityGroupEnabled, long physicalNetworkId) throws ConcurrentOperationException; diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index be430452133..a274e684e74 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -96,6 +96,7 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.host.dao.HostDetailsDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.network.Network; +import com.cloud.network.Network.Capability; import com.cloud.network.Network.GuestType; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; @@ -2968,19 +2969,73 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura } } - return createNetworkOffering(userId, name, displayText, trafficType, tags, maxConnections, specifyVlan, availability, networkRate, serviceProviderMap, false, guestType, false, serviceOfferingId); + // verify the LB service capabilities specified in the network offering + Map lbServiceCapabilityMap = cmd.getServiceCapabilities(Service.Lb); + if (!cmd.getLbService() && lbServiceCapabilityMap != null && !lbServiceCapabilityMap.isEmpty()) { + throw new InvalidParameterValueException("Capabilities for LB service can be specifed only when LB service is enabled for network offering."); + } + validateLoadBalancerServiceCapabilities(lbServiceCapabilityMap); + + // verify the Firewall service capabilities specified in the network offering + Map fwServiceCapabilityMap = cmd.getServiceCapabilities(Service.Firewall); + if (!cmd.getFirewallService() && fwServiceCapabilityMap != null && !fwServiceCapabilityMap.isEmpty()) { + throw new InvalidParameterValueException("Capabilities for Firewall service can be specifed only when Firewall service is enabled for network offering."); + } + validateFirewallServiceCapablities(fwServiceCapabilityMap); + + return createNetworkOffering(userId, name, displayText, trafficType, tags, maxConnections, specifyVlan, availability, networkRate, serviceProviderMap, false, + guestType, false, serviceOfferingId, lbServiceCapabilityMap, fwServiceCapabilityMap); } + void validateLoadBalancerServiceCapabilities(Map lbServiceCapabilityMap) { + if ((lbServiceCapabilityMap != null) && (lbServiceCapabilityMap.keySet().size() > 1 || !lbServiceCapabilityMap.containsKey(Capability.SupportedLBIsolation.getName()))) { + throw new InvalidParameterValueException("Only Load balancer isolation capability can be sepcified for LB service"); + } else { + String isolationCapability = lbServiceCapabilityMap.get(Capability.SupportedLBIsolation.getName()); + boolean dedicatedLb = isolationCapability.contains("dedicated"); + boolean sharedLB = isolationCapability.contains("shared"); + if ((dedicatedLb && sharedLB) || (!dedicatedLb && !sharedLB)){ + throw new InvalidParameterValueException("Either dedicated or shared isolation can be specified for " + Capability.SupportedLBIsolation.getName()); + } + } + } + + void validateFirewallServiceCapablities(Map fwServiceCapabilityMap) { + if ((fwServiceCapabilityMap != null) && (fwServiceCapabilityMap.keySet().size() > 1) || !fwServiceCapabilityMap.containsKey(Capability.SupportedSourceNatTypes.getName())) { + throw new InvalidParameterValueException("Only Supported Source NAT type capability can be sepcified for firewall service"); + } else { + String sourceNatType = fwServiceCapabilityMap.get(Capability.SupportedSourceNatTypes.getName()); + boolean perAccount = sourceNatType.contains("peraccount"); + boolean perZone = sourceNatType.contains("perzone"); + if ((perAccount && perZone) || (!perAccount && !perZone)) { + throw new InvalidParameterValueException("Either perAccount or perZone source NAT type can be specified for " + Capability.SupportedSourceNatTypes.getName()); + } + } + } + @Override @DB public NetworkOfferingVO createNetworkOffering(long userId, String name, String displayText, TrafficType trafficType, String tags, Integer maxConnections, boolean specifyVlan, - Availability availability, Integer networkRate, Map> serviceProviderMap, boolean isDefault, Network.GuestType type, boolean systemOnly, Long serviceOfferingId) { + Availability availability, Integer networkRate, Map> serviceProviderMap, boolean isDefault, Network.GuestType type, + boolean systemOnly, Long serviceOfferingId, Map lbServiceCapabilityMap, Map fwServiceCapabilityMap) { String multicastRateStr = _configDao.getValue("multicast.throttling.rate"); int multicastRate = ((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr)); tags = cleanupTags(tags); - NetworkOfferingVO offering = new NetworkOfferingVO(name, displayText, trafficType, systemOnly, specifyVlan, networkRate, multicastRate, maxConnections, isDefault, availability, tags, type); + boolean dedicatedLb = true; + if ((lbServiceCapabilityMap != null) && (!lbServiceCapabilityMap.isEmpty())) { + String isolationCapability = lbServiceCapabilityMap.get(Capability.SupportedLBIsolation); + dedicatedLb = isolationCapability.contains("dedicated"); + } + + boolean sharedSourceNat = false; + if ((fwServiceCapabilityMap != null) && (!fwServiceCapabilityMap.isEmpty())) { + String sourceNatType = fwServiceCapabilityMap.get(Capability.SupportedSourceNatTypes.getName()); + sharedSourceNat = sourceNatType.contains("perzone"); + } + + NetworkOfferingVO offering = new NetworkOfferingVO(name, displayText, trafficType, systemOnly, specifyVlan, networkRate, multicastRate, maxConnections, isDefault, availability, tags, type, dedicatedLb, sharedSourceNat); if (serviceOfferingId != null) { offering.setServiceOfferingId(serviceOfferingId); @@ -3318,6 +3373,35 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura } } + // verify and update the LB service capabilities specified in the network offering + Map lbServiceCapabilityMap = cmd.getServiceCapabilities(Service.Lb); + boolean dedicatedLb = true; + if (!cmd.getLbService() && lbServiceCapabilityMap != null && !lbServiceCapabilityMap.isEmpty()) { + throw new InvalidParameterValueException("Capabilities for LB service can be specifed only when LB service is enabled for network offering."); + } + validateLoadBalancerServiceCapabilities(lbServiceCapabilityMap); + + if ((lbServiceCapabilityMap != null) && (!lbServiceCapabilityMap.isEmpty())) { + String isolationCapability = lbServiceCapabilityMap.get(Capability.SupportedLBIsolation); + dedicatedLb = isolationCapability.contains("dedicated"); + } + offering.setDedicatedLb(dedicatedLb); + + // verify the Firewall service capabilities specified in the network offering + Map fwServiceCapabilityMap = cmd.getServiceCapabilities(Service.Firewall); + boolean sharedSourceNat = false; + + if (!cmd.getFirewallService() && fwServiceCapabilityMap != null && !fwServiceCapabilityMap.isEmpty()) { + throw new InvalidParameterValueException("Capabilities for Firewall service can be specifed only when Firewall service is enabled for network offering."); + } + validateFirewallServiceCapablities(fwServiceCapabilityMap); + + if ((fwServiceCapabilityMap != null) && (!fwServiceCapabilityMap.isEmpty())) { + String sourceNatType = fwServiceCapabilityMap.get(Capability.SupportedSourceNatTypes.getName()); + sharedSourceNat = sourceNatType.contains("perzone"); + } + offering.setSharedSourceNat(sharedSourceNat); + if (svcPrv != null && !svcPrv.isEmpty()) { if (networksExist) { throw new InvalidParameterValueException("Unable to reset service providers as there are existing networks using this network offering"); diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index b560bab75c8..167ae532486 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -898,22 +898,22 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag NetworkOfferingVO offering = null; if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOfferingWithSGService) == null) { - offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultSharedNetworkOfferingWithSGService, "Offering for Shared Security group enabled networks", TrafficType.Guest, null, null, false, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null); + offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultSharedNetworkOfferingWithSGService, "Offering for Shared Security group enabled networks", TrafficType.Guest, null, null, false, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, null, null); _networkOfferingDao.update(offering.getId(), offering); } if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOffering) == null) { - offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null); + offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, null, null); _networkOfferingDao.update(offering.getId(), offering); } if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService) == null) { - offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM,NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService, "Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest, null, null, false, Availability.Required, null, defaultIsolatedSourceNatEnabledNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null); + offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM,NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService, "Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest, null, null, false, Availability.Required, null, defaultIsolatedSourceNatEnabledNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, null, null); _networkOfferingDao.update(offering.getId(), offering); } if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOffering) == null) { - offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultIsolatedNetworkOffering, "Offering for Isolated networks with no Source Nat service", TrafficType.Guest, null, null, true, Availability.Optional, null, defaultIsolatedNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null); + offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultIsolatedNetworkOffering, "Offering for Isolated networks with no Source Nat service", TrafficType.Guest, null, null, true, Availability.Optional, null, defaultIsolatedNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, null, null); _networkOfferingDao.update(offering.getId(), offering); } diff --git a/server/src/com/cloud/network/element/ElasticLoadBalancerElement.java b/server/src/com/cloud/network/element/ElasticLoadBalancerElement.java index 35394a12dd1..7cfadc54971 100644 --- a/server/src/com/cloud/network/element/ElasticLoadBalancerElement.java +++ b/server/src/com/cloud/network/element/ElasticLoadBalancerElement.java @@ -89,6 +89,7 @@ public class ElasticLoadBalancerElement extends AdapterBase implements LoadBalan Map lbCapabilities = new HashMap(); lbCapabilities.put(Capability.SupportedLBAlgorithms, "roundrobin,leastconn,source"); + lbCapabilities.put(Capability.SupportedLBIsolation, "shared"); lbCapabilities.put(Capability.SupportedProtocols, "tcp, udp"); capabilities.put(Service.Lb, lbCapabilities); diff --git a/server/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java b/server/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java index 933ba8a7801..72779d4a783 100644 --- a/server/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java +++ b/server/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java @@ -135,7 +135,10 @@ public class F5ExternalLoadBalancerElement extends AdapterBase implements LoadBa // Specifies that the RoundRobin and Leastconn algorithms are supported for load balancing rules lbCapabilities.put(Capability.SupportedLBAlgorithms, "roundrobin,leastconn"); - + + // specifies that F5 BIG IP network element can provide shared mode only + lbCapabilities.put(Capability.SupportedLBIsolation, "shared"); + // Specifies that load balancing rules can be made for either TCP or UDP traffic lbCapabilities.put(Capability.SupportedProtocols, "tcp,udp"); diff --git a/server/src/com/cloud/network/element/NetscalerExternalLoadBalancerElement.java b/server/src/com/cloud/network/element/NetscalerExternalLoadBalancerElement.java index e09bbec65eb..0b925b9d53b 100644 --- a/server/src/com/cloud/network/element/NetscalerExternalLoadBalancerElement.java +++ b/server/src/com/cloud/network/element/NetscalerExternalLoadBalancerElement.java @@ -135,7 +135,10 @@ public class NetscalerExternalLoadBalancerElement extends AdapterBase implements // Specifies that the RoundRobin and Leastconn algorithms are supported for load balancing rules lbCapabilities.put(Capability.SupportedLBAlgorithms, "roundrobin,leastconn"); - + + // specifies that Netscaler network element can provided both shared and isolation modes + lbCapabilities.put(Capability.SupportedLBIsolation, "dedicated, shared"); + // Specifies that load balancing rules can be made for either TCP or UDP traffic lbCapabilities.put(Capability.SupportedProtocols, "tcp,udp"); diff --git a/server/src/com/cloud/network/element/VirtualRouterElement.java b/server/src/com/cloud/network/element/VirtualRouterElement.java index d92613f1f00..88c2a98b360 100644 --- a/server/src/com/cloud/network/element/VirtualRouterElement.java +++ b/server/src/com/cloud/network/element/VirtualRouterElement.java @@ -277,6 +277,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl //Set capabilities for LB service Map lbCapabilities = new HashMap(); lbCapabilities.put(Capability.SupportedLBAlgorithms, "roundrobin,leastconn,source"); + lbCapabilities.put(Capability.SupportedLBIsolation, "dedicated"); lbCapabilities.put(Capability.SupportedProtocols, "tcp, udp"); capabilities.put(Service.Lb, lbCapabilities); diff --git a/server/src/com/cloud/offerings/NetworkOfferingVO.java b/server/src/com/cloud/offerings/NetworkOfferingVO.java index 26e0f8c4f27..0c244c2628b 100644 --- a/server/src/com/cloud/offerings/NetworkOfferingVO.java +++ b/server/src/com/cloud/offerings/NetworkOfferingVO.java @@ -97,6 +97,12 @@ public class NetworkOfferingVO implements NetworkOffering { @Enumerated(value=EnumType.STRING) Network.GuestType guestType; + @Column(name="dedicated_lb_service") + boolean dedicatedLB; + + @Column(name="shared_source_nat_service") + boolean sharedSourceNat; + @Override public String getDisplayText() { return displayText; @@ -213,7 +219,26 @@ public class NetworkOfferingVO implements NetworkOffering { return serviceOfferingId; } - public NetworkOfferingVO(String name, String displayText, TrafficType trafficType, boolean systemOnly, boolean specifyVlan, Integer rateMbps, Integer multicastRateMbps, Integer concurrentConnections, boolean isDefault, Availability availability, String tags, Network.GuestType guestType) { + @Override + public boolean getDedicatedLB() { + return dedicatedLB; + } + + public void setDedicatedLb(boolean dedicatedLB) { + this.dedicatedLB = dedicatedLB; + } + + @Override + public boolean getSharedSourceNat() { + return sharedSourceNat; + } + + public void setSharedSourceNat(boolean sharedSourceNat) { + this.sharedSourceNat = sharedSourceNat; + } + + public NetworkOfferingVO(String name, String displayText, TrafficType trafficType, boolean systemOnly, boolean specifyVlan, Integer rateMbps, Integer multicastRateMbps, Integer concurrentConnections, + boolean isDefault, Availability availability, String tags, Network.GuestType guestType) { this.name = name; this.displayText = displayText; this.rateMbps = rateMbps; @@ -227,6 +252,15 @@ public class NetworkOfferingVO implements NetworkOffering { this.uniqueName = name; this.tags = tags; this.guestType = guestType; + this.dedicatedLB = true; + this.sharedSourceNat =false; + } + + public NetworkOfferingVO(String name, String displayText, TrafficType trafficType, boolean systemOnly, boolean specifyVlan, Integer rateMbps, Integer multicastRateMbps, Integer concurrentConnections, + boolean isDefault, Availability availability, String tags, Network.GuestType guestType, boolean dedicatedLb, boolean sharedSourceNat) { + this(name, displayText, trafficType, systemOnly, specifyVlan, rateMbps, multicastRateMbps, concurrentConnections, isDefault, availability, tags, guestType); + this.dedicatedLB = dedicatedLb; + this.sharedSourceNat = sharedSourceNat; } public NetworkOfferingVO() { diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql index d6d26a6f173..75706066e1a 100755 --- a/setup/db/create-schema.sql +++ b/setup/db/create-schema.sql @@ -254,6 +254,7 @@ CREATE TABLE `cloud`.`network_offerings` ( `removed` datetime DEFAULT NULL COMMENT 'time the entry was removed', `default` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if network offering is default', `availability` varchar(255) NOT NULL COMMENT 'availability of the network', + `dedicated_lb_service` int(1) unsigned NOT NULL DEFAULT 1 COMMENT 'true if the network offering provides a dedicated load balancer for each network', `shared_source_nat_service` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if the network offering provides the shared source nat service', `state` char(32) COMMENT 'state of the network offering; has Disabled value by default', `guest_type` char(32) COMMENT 'type of guest network; can be shared or isolated',