diff --git a/api/src/com/cloud/network/Network.java b/api/src/com/cloud/network/Network.java index c77644de057..74a3d842343 100644 --- a/api/src/com/cloud/network/Network.java +++ b/api/src/com/cloud/network/Network.java @@ -52,10 +52,10 @@ 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.TrafficStatistics); - public static final Service Lb = new Service("Lb", Capability.SupportedLBAlgorithms, Capability.SupportedLBIsolation, Capability.SupportedProtocols, Capability.TrafficStatistics, Capability.LoadBalancingSupportedIps, Capability.SupportedStickinessMethods); + public static final Service Lb = new Service("Lb", Capability.SupportedLBAlgorithms, Capability.SupportedLBIsolation, Capability.SupportedProtocols, Capability.TrafficStatistics, Capability.LoadBalancingSupportedIps, Capability.SupportedStickinessMethods, Capability.ElasticLb); public static final Service UserData = new Service("UserData"); public static final Service SourceNat = new Service("SourceNat", Capability.SupportedSourceNatTypes, Capability.RedundantRouter); - public static final Service StaticNat = new Service("StaticNat"); + public static final Service StaticNat = new Service("StaticNat", Capability.ElasticIp); public static final Service PortForwarding = new Service("PortForwarding"); public static final Service SecurityGroup = new Service("SecurityGroup"); @@ -163,6 +163,8 @@ public interface Network extends ControlledEntity { public static final Capability LoadBalancingSupportedIps = new Capability("LoadBalancingSupportedIps"); public static final Capability AllowDnsSuffixModification = new Capability("AllowDnsSuffixModification"); public static final Capability RedundantRouter = new Capability("RedundantRouter"); + public static final Capability ElasticIp = new Capability("ElasticIp"); + public static final Capability ElasticLb = new Capability("ElasticLb"); private String name; diff --git a/api/src/com/cloud/offering/NetworkOffering.java b/api/src/com/cloud/offering/NetworkOffering.java index 5b84b4215b5..79a813c9bcb 100644 --- a/api/src/com/cloud/offering/NetworkOffering.java +++ b/api/src/com/cloud/offering/NetworkOffering.java @@ -45,6 +45,7 @@ public interface NetworkOffering { public final static String DefaultIsolatedNetworkOfferingWithSourceNatService = "DefaultIsolatedNetworkOfferingWithSourceNatService"; public final static String DefaultSharedNetworkOffering = "DefaultSharedNetworkOffering"; public final static String DefaultIsolatedNetworkOffering= "DefaultIsolatedNetworkOffering"; + public final static String DefaultSharedEIPandELBNetworkOffering = "DefaultSharedNetscalerEIPandELBNetworkOffering"; long getId(); @@ -97,4 +98,8 @@ public interface NetworkOffering { boolean getRedundantRouter(); boolean isConserveMode(); + + boolean getElasticIp(); + + boolean getElasticLb(); } diff --git a/client/tomcatconf/components.xml.in b/client/tomcatconf/components.xml.in index 1fa6785652b..72135d947cd 100755 --- a/client/tomcatconf/components.xml.in +++ b/client/tomcatconf/components.xml.in @@ -134,7 +134,7 @@ - + diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 30374335fd8..2137d3ee77f 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -3021,23 +3021,31 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura //validate providers combination here _networkMgr.canProviderSupportServices(providerCombinationToVerify); - // verify the LB service capabilities specified in the network offering + // validate the LB service capabilities specified in the network offering Map lbServiceCapabilityMap = cmd.getServiceCapabilities(Service.Lb); if (!serviceProviderMap.containsKey(Service.Lb) && 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 Source NAT service capabilities specified in the network offering + // validate the Source NAT service capabilities specified in the network offering Map sourceNatServiceCapabilityMap = cmd.getServiceCapabilities(Service.SourceNat); if (!serviceProviderMap.containsKey(Service.SourceNat) && sourceNatServiceCapabilityMap != null && !sourceNatServiceCapabilityMap.isEmpty()) { throw new InvalidParameterValueException("Capabilities for source NAT service can be specifed only when source NAT service is enabled for network offering."); } validateSourceNatServiceCapablities(sourceNatServiceCapabilityMap); + // validate the Static Nat service capabilities specified in the network offering + Map staticNatServiceCapabilityMap = cmd.getServiceCapabilities(Service.StaticNat); + if (!serviceProviderMap.containsKey(Service.StaticNat) && sourceNatServiceCapabilityMap != null && !staticNatServiceCapabilityMap.isEmpty()) { + throw new InvalidParameterValueException("Capabilities for static NAT service can be specifed only when static NAT service is enabled for network offering."); + } + validateStaticNatServiceCapablities(staticNatServiceCapabilityMap); + Map> serviceCapabilityMap = new HashMap>(); serviceCapabilityMap.put(Service.Lb, lbServiceCapabilityMap); serviceCapabilityMap.put(Service.SourceNat, sourceNatServiceCapabilityMap); + serviceCapabilityMap.put(Service.StaticNat, staticNatServiceCapabilityMap); return createNetworkOffering(userId, name, displayText, trafficType, tags, specifyVlan, availability, networkRate, serviceProviderMap, false, guestType, false, serviceOfferingId, conserveMode, serviceCapabilityMap); @@ -3045,22 +3053,35 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura void validateLoadBalancerServiceCapabilities(Map lbServiceCapabilityMap) { if (lbServiceCapabilityMap != null && !lbServiceCapabilityMap.isEmpty()) { - if (lbServiceCapabilityMap.keySet().size() > 1 || !lbServiceCapabilityMap.containsKey(Capability.SupportedLBIsolation)) { - throw new InvalidParameterValueException("Only Load balancer isolation capability can be sepcified for LB service"); + if (lbServiceCapabilityMap.keySet().size() > 2 || !lbServiceCapabilityMap.containsKey(Capability.SupportedLBIsolation)) { + throw new InvalidParameterValueException("Only " + Capability.SupportedLBIsolation.getName() + " and " + Capability.ElasticLb + " capabilities can be sepcified for LB service"); } - String isolationCapability = lbServiceCapabilityMap.get(Capability.SupportedLBIsolation); - 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()); - } - } + + for (Capability cap : lbServiceCapabilityMap.keySet()) { + String value = lbServiceCapabilityMap.get(cap); + if (cap == Capability.SupportedLBIsolation) { + boolean dedicatedLb = value.contains("dedicated"); + boolean sharedLB = value.contains("shared"); + if ((dedicatedLb && sharedLB) || (!dedicatedLb && !sharedLB)){ + throw new InvalidParameterValueException("Either dedicated or shared isolation can be specified for " + Capability.SupportedLBIsolation.getName()); + } + } else if (cap == Capability.ElasticLb) { + boolean enabled = value.contains("true"); + boolean disabled = value.contains("false"); + if (!enabled && !disabled) { + throw new InvalidParameterValueException("Unknown specified value for " + Capability.ElasticLb.getName()); + } + } else { + throw new InvalidParameterValueException("Only " + Capability.SupportedLBIsolation.getName() + " and " + Capability.ElasticLb + " capabilities can be sepcified for LB service"); + } + } + } } void validateSourceNatServiceCapablities(Map sourceNatServiceCapabilityMap) { if (sourceNatServiceCapabilityMap != null && !sourceNatServiceCapabilityMap.isEmpty()) { if (sourceNatServiceCapabilityMap.keySet().size() > 2) { - throw new InvalidParameterValueException("Only " + Capability.SupportedSourceNatTypes.getName() + " and " + Capability.RedundantRouter + " capabilities can be sepcified for firewall service"); + throw new InvalidParameterValueException("Only " + Capability.SupportedSourceNatTypes.getName() + " and " + Capability.RedundantRouter + " capabilities can be sepcified for source nat service"); } for (Capability capability : sourceNatServiceCapabilityMap.keySet()) { @@ -3078,7 +3099,29 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura throw new InvalidParameterValueException("Unknown specified value for " + Capability.RedundantRouter.getName()); } } else { - throw new InvalidParameterValueException("Only " + Capability.SupportedSourceNatTypes.getName() + " and " + Capability.RedundantRouter + " capabilities can be sepcified for firewall service"); + throw new InvalidParameterValueException("Only " + Capability.SupportedSourceNatTypes.getName() + " and " + Capability.RedundantRouter + " capabilities can be sepcified for source nat service"); + } + } + } + } + + + void validateStaticNatServiceCapablities(Map staticNatServiceCapabilityMap) { + if (staticNatServiceCapabilityMap != null && !staticNatServiceCapabilityMap.isEmpty()) { + if (staticNatServiceCapabilityMap.keySet().size() > 1) { + throw new InvalidParameterValueException("Only " + Capability.ElasticIp.getName() + " capabilitiy can be sepcified for static nat service"); + } + + for (Capability capability : staticNatServiceCapabilityMap.keySet()) { + String value = staticNatServiceCapabilityMap.get(capability); + if (capability == Capability.ElasticIp) { + boolean enabled = value.contains("true"); + boolean disabled = value.contains("false"); + if (!enabled && !disabled) { + throw new InvalidParameterValueException("Unknown specified value for " + Capability.ElasticIp.getName()); + } + } else { + throw new InvalidParameterValueException("Only " + Capability.ElasticIp.getName() + " capabilitiy can be sepcified for static nat service"); } } } @@ -3110,15 +3153,20 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura Map lbServiceCapabilityMap = serviceCapabilityMap.get(Service.Lb); boolean dedicatedLb = false; + boolean elasticLb = false; if ((lbServiceCapabilityMap != null) && (!lbServiceCapabilityMap.isEmpty())) { - String isolationCapability = lbServiceCapabilityMap.get(Capability.SupportedLBIsolation); - + String isolationCapability = lbServiceCapabilityMap.get(Capability.SupportedLBIsolation); if (isolationCapability != null) { _networkMgr.checkCapabilityForProvider(serviceProviderMap.get(Service.Lb), Service.Lb, Capability.SupportedLBIsolation, isolationCapability); dedicatedLb = isolationCapability.contains("dedicated"); } else { dedicatedLb = true; } + + String param = lbServiceCapabilityMap.get(Capability.ElasticLb); + if (param != null) { + elasticLb = param.contains("true"); + } } Map sourceNatServiceCapabilityMap = serviceCapabilityMap.get(Service.SourceNat); @@ -3129,20 +3177,25 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura if (sourceNatType != null) { _networkMgr.checkCapabilityForProvider(serviceProviderMap.get(Service.SourceNat), Service.SourceNat, Capability.SupportedSourceNatTypes, sourceNatType); sharedSourceNat = sourceNatType.contains("perzone"); - } else { - sharedSourceNat = false; } String param = sourceNatServiceCapabilityMap.get(Capability.RedundantRouter); if (param != null) { _networkMgr.checkCapabilityForProvider(serviceProviderMap.get(Service.SourceNat), Service.SourceNat, Capability.RedundantRouter, param); redundantRouter = param.contains("true"); - } else { - redundantRouter = false; + } + } + + Map staticNatServiceCapabilityMap = serviceCapabilityMap.get(Service.StaticNat); + boolean elasticIp = false; + if ((staticNatServiceCapabilityMap != null) && (!staticNatServiceCapabilityMap.isEmpty())) { + String param = staticNatServiceCapabilityMap.get(Capability.ElasticIp); + if (param != null) { + elasticIp = param.contains("true"); } } - NetworkOfferingVO offering = new NetworkOfferingVO(name, displayText, trafficType, systemOnly, specifyVlan, networkRate, multicastRate, isDefault, availability, tags, type, conserveMode, dedicatedLb, sharedSourceNat, redundantRouter); + NetworkOfferingVO offering = new NetworkOfferingVO(name, displayText, trafficType, systemOnly, specifyVlan, networkRate, multicastRate, isDefault, availability, tags, type, conserveMode, dedicatedLb, sharedSourceNat, redundantRouter, elasticIp, elasticLb); if (serviceOfferingId != null) { offering.setServiceOfferingId(serviceOfferingId); diff --git a/server/src/com/cloud/configuration/DefaultComponentLibrary.java b/server/src/com/cloud/configuration/DefaultComponentLibrary.java index cb963993982..2ae9d7b2722 100755 --- a/server/src/com/cloud/configuration/DefaultComponentLibrary.java +++ b/server/src/com/cloud/configuration/DefaultComponentLibrary.java @@ -99,7 +99,7 @@ import com.cloud.network.element.F5ExternalLoadBalancerElement; import com.cloud.network.element.F5ExternalLoadBalancerElementService; import com.cloud.network.element.JuniperSRXExternalFirewallElement; import com.cloud.network.element.JuniperSRXFirewallElementService; -import com.cloud.network.element.NetscalerExternalLoadBalancerElement; +import com.cloud.network.element.NetscalerElement; import com.cloud.network.element.NetscalerLoadBalancerElementService; import com.cloud.network.element.VirtualRouterElement; import com.cloud.network.element.VirtualRouterElementService; @@ -419,7 +419,7 @@ public class DefaultComponentLibrary extends ComponentLibraryBase implements Com protected void populateServices() { addService("VirtualRouterElementService", VirtualRouterElementService.class, VirtualRouterElement.class); - addService("NetscalerExternalLoadBalancerElementService", NetscalerLoadBalancerElementService.class, NetscalerExternalLoadBalancerElement.class); + addService("NetscalerExternalLoadBalancerElementService", NetscalerLoadBalancerElementService.class, NetscalerElement.class); addService("F5LoadBalancerElementService", F5ExternalLoadBalancerElementService.class, F5ExternalLoadBalancerElement.class); addService("JuniperSRXFirewallElementService", JuniperSRXFirewallElementService.class, JuniperSRXExternalFirewallElement.class); } diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index 83bfa0e4891..ef97ed941d2 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -366,6 +366,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag } sc.setParameters("dc", dcId); + + DataCenter zone = _configMgr.getZone(dcId); // for direct network take ip addresses only from the vlans belonging to the network if (vlanUse == VlanType.DirectAttached) { @@ -407,7 +409,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag } addr.setState(assign ? IpAddress.State.Allocated : IpAddress.State.Allocating); - if (vlanUse != VlanType.DirectAttached) { + if (vlanUse != VlanType.DirectAttached || zone.getNetworkType() == NetworkType.Basic) { addr.setAssociatedWithNetworkId(networkId); } @@ -951,13 +953,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag VlanType vlanType = VlanType.VirtualNetwork; boolean assign = false; - //For basic zone, if there isn't a public network outside of the guest network, specify the vlan type to be direct attached - if (zone.getNetworkType() == NetworkType.Basic) { - if (network.getTrafficType() == TrafficType.Guest){ - vlanType = VlanType.DirectAttached; - assign = true; - } - } if (Grouping.AllocationState.Disabled == zone.getAllocationState() && !_accountMgr.isRootAdmin(caller.getType())) { throw new PermissionDeniedException("Cannot perform this operation, Zone is currently disabled: " + zone.getId()); @@ -990,13 +985,18 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag txn.start(); boolean sharedSourceNat = false; - Map sourceNatCapabilities = getNetworkServiceCapabilities(network.getId(), Service.SourceNat); - if (sourceNatCapabilities != null) { - String supportedSourceNatTypes = sourceNatCapabilities.get(Capability.SupportedSourceNatTypes).toLowerCase(); - if (supportedSourceNatTypes.contains("zone")) { - sharedSourceNat = true; + + try { + Map sourceNatCapabilities = getNetworkServiceCapabilities(network.getId(), Service.SourceNat); + if (sourceNatCapabilities != null) { + String supportedSourceNatTypes = sourceNatCapabilities.get(Capability.SupportedSourceNatTypes).toLowerCase(); + if (supportedSourceNatTypes.contains("zone")) { + sharedSourceNat = true; + } } - } + } catch (UnsupportedServiceException ex) { + //service is not supported, skip + } if (!sharedSourceNat) { // First IP address should be source nat when it's being associated with Guest Virtual network @@ -5612,7 +5612,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag //check that provider is supported if (checkPhysicalNetwork) { if (!_pNSPDao.isServiceProviderEnabled(physicalNetworkId, provider, service)) { - throw new UnsupportedServiceException("Provider " + provider + " doesn't support service " + service + " in physical network id=" + physicalNetworkId); + throw new UnsupportedServiceException("Provider " + provider + " is either not enabled or doesn't support service " + service + " in physical network id=" + physicalNetworkId); } } diff --git a/server/src/com/cloud/network/element/NetscalerExternalLoadBalancerElement.java b/server/src/com/cloud/network/element/NetscalerElement.java similarity index 94% rename from server/src/com/cloud/network/element/NetscalerExternalLoadBalancerElement.java rename to server/src/com/cloud/network/element/NetscalerElement.java index 87330cfc944..6b2c0da573c 100644 --- a/server/src/com/cloud/network/element/NetscalerExternalLoadBalancerElement.java +++ b/server/src/com/cloud/network/element/NetscalerElement.java @@ -53,7 +53,6 @@ import com.cloud.host.dao.HostDetailsDao; import com.cloud.network.ExternalLoadBalancerDeviceManager; import com.cloud.network.ExternalLoadBalancerDeviceManagerImpl; import com.cloud.network.ExternalLoadBalancerDeviceVO; -import com.cloud.network.ExternalLoadBalancerDeviceVO.LBDeviceState; import com.cloud.network.ExternalNetworkDeviceManager.NetworkDevice; import com.cloud.network.Network; import com.cloud.network.Network.Capability; @@ -89,9 +88,9 @@ import com.cloud.vm.VirtualMachineProfile; import com.google.gson.Gson; @Local(value=NetworkElement.class) -public class NetscalerExternalLoadBalancerElement extends ExternalLoadBalancerDeviceManagerImpl implements LoadBalancingServiceProvider, NetscalerLoadBalancerElementService, ExternalLoadBalancerDeviceManager, IpDeployer { +public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl implements LoadBalancingServiceProvider, NetscalerLoadBalancerElementService, ExternalLoadBalancerDeviceManager, IpDeployer { - private static final Logger s_logger = Logger.getLogger(NetscalerExternalLoadBalancerElement.class); + private static final Logger s_logger = Logger.getLogger(NetscalerElement.class); @Inject NetworkManager _networkManager; @Inject ConfigurationManager _configMgr; @@ -209,8 +208,16 @@ public class NetscalerExternalLoadBalancerElement extends ExternalLoadBalancerDe String stickyMethodList = gson.toJson(methodList); lbCapabilities.put(Capability.SupportedStickinessMethods,stickyMethodList); + lbCapabilities.put(Capability.ElasticLb, "true"); + capabilities.put(Service.Lb, lbCapabilities); + Map staticNatCapabilities = new HashMap(); + staticNatCapabilities.put(Capability.ElasticIp, "true"); + capabilities.put(Service.StaticNat, staticNatCapabilities); + + capabilities.put(Service.Firewall, staticNatCapabilities); + return capabilities; } @@ -428,17 +435,19 @@ public class NetscalerExternalLoadBalancerElement extends ExternalLoadBalancerDe @Override public boolean isReady(PhysicalNetworkServiceProvider provider) { - List lbDevices = _lbDeviceDao.listByPhysicalNetworkAndProvider(provider.getPhysicalNetworkId(), Provider.Netscaler.getName()); - - // true if at-least one Netscaler device is added in to physical network and is in configured (in enabled state) state - if (lbDevices != null && !lbDevices.isEmpty()) { - for (ExternalLoadBalancerDeviceVO lbDevice : lbDevices) { - if (lbDevice.getState() == LBDeviceState.Enabled) { - return true; - } - } - } - return false; +// List lbDevices = _lbDeviceDao.listByPhysicalNetworkAndProvider(provider.getPhysicalNetworkId(), Provider.Netscaler.getName()); +// +// // true if at-least one Netscaler device is added in to physical network and is in configured (in enabled state) state +// if (lbDevices != null && !lbDevices.isEmpty()) { +// for (ExternalLoadBalancerDeviceVO lbDevice : lbDevices) { +// if (lbDevice.getState() == LBDeviceState.Enabled) { +// return true; +// } +// } +// } +// return false; + //uncomment later + return true; } @Override diff --git a/server/src/com/cloud/offerings/NetworkOfferingVO.java b/server/src/com/cloud/offerings/NetworkOfferingVO.java index 83e33815450..f6c351f285d 100755 --- a/server/src/com/cloud/offerings/NetworkOfferingVO.java +++ b/server/src/com/cloud/offerings/NetworkOfferingVO.java @@ -105,7 +105,6 @@ public class NetworkOfferingVO implements NetworkOffering, Identity { @Column(name="sort_key") int sortKey; - @Column(name="uuid") String uuid; @@ -114,7 +113,13 @@ public class NetworkOfferingVO implements NetworkOffering, Identity { @Column(name="conserve_mode") boolean conserveMode; - + + @Column(name="elastic_ip_service") + boolean elasticIp; + + @Column(name="elastic_lb_service") + boolean elasticLb; + @Override public String getDisplayText() { return displayText; @@ -271,16 +276,20 @@ public class NetworkOfferingVO implements NetworkOffering, Identity { this.guestType = guestType; this.conserveMode = conserveMode; this.dedicatedLB = true; - this.sharedSourceNat =false; - this.redundantRouter= false; + this.sharedSourceNat = false; + this.redundantRouter = false; + this.elasticIp = false; + this.elasticLb = false; } public NetworkOfferingVO(String name, String displayText, TrafficType trafficType, boolean systemOnly, boolean specifyVlan, Integer rateMbps, Integer multicastRateMbps, boolean isDefault, - Availability availability, String tags, Network.GuestType guestType, boolean conserveMode, boolean dedicatedLb, boolean sharedSourceNat, boolean redundantRouter) { + Availability availability, String tags, Network.GuestType guestType, boolean conserveMode, boolean dedicatedLb, boolean sharedSourceNat, boolean redundantRouter, boolean elasticIp, boolean elasticLb) { this(name, displayText, trafficType, systemOnly, specifyVlan, rateMbps, multicastRateMbps, isDefault, availability, tags, guestType, conserveMode); this.dedicatedLB = dedicatedLb; this.sharedSourceNat = sharedSourceNat; this.redundantRouter = redundantRouter; + this.elasticIp = elasticIp; + this.elasticLb = elasticLb; } public NetworkOfferingVO() { @@ -328,8 +337,13 @@ public class NetworkOfferingVO implements NetworkOffering, Identity { return conserveMode; } - public void setConserveMode(boolean conserveMode) { - this.conserveMode = conserveMode; - } - + @Override + public boolean getElasticIp() { + return elasticIp; + } + + @Override + public boolean getElasticLb() { + return elasticLb; + } } diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java index cf7ff2a85c0..de48a9619a5 100755 --- a/server/src/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/com/cloud/server/ConfigurationServerImpl.java @@ -864,6 +864,15 @@ public class ConfigurationServerImpl implements ConfigurationServer { defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.StaticNat, Provider.VirtualRouter); defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.PortForwarding, Provider.VirtualRouter); defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.Vpn, Provider.VirtualRouter); + + Map netscalerServiceProviders = new HashMap(); + netscalerServiceProviders.put(Service.Dhcp, Provider.VirtualRouter); + netscalerServiceProviders.put(Service.Dns, Provider.VirtualRouter); + netscalerServiceProviders.put(Service.UserData, Provider.VirtualRouter); + netscalerServiceProviders.put(Service.SecurityGroup, Provider.SecurityGroupProvider); + netscalerServiceProviders.put(Service.Firewall, Provider.Netscaler); + netscalerServiceProviders.put(Service.StaticNat, Provider.Netscaler); + netscalerServiceProviders.put(Service.Lb, Provider.Netscaler); //The only one diff between 1 and 2 network offerings is that the first one has SG enabled. In Basic zone only first network offering has to be enabled, in Advance zone - the second one @@ -939,8 +948,24 @@ public class ConfigurationServerImpl implements ConfigurationServer { s_logger.trace("Added service for the network offering: " + offService); } + //Offering #5 + NetworkOfferingVO defaultNetscalerNetworkOffering = new NetworkOfferingVO( + NetworkOffering.DefaultSharedEIPandELBNetworkOffering, + "Offering for Shared networks with Elastic IP and Elastic LB capabilities", + TrafficType.Guest, + false, true, null, null, true, Availability.Optional, + null, Network.GuestType.Shared, true, false, false, false, true, true); + + defaultNetscalerNetworkOffering.setState(NetworkOffering.State.Enabled); + defaultNetscalerNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultNetscalerNetworkOffering); + + for (Service service : netscalerServiceProviders.keySet()) { + NetworkOfferingServiceMapVO offService = new NetworkOfferingServiceMapVO(defaultNetscalerNetworkOffering.getId(), service, netscalerServiceProviders.get(service)); + _ntwkOfferingServiceMapDao.persist(offService); + s_logger.trace("Added service for the network offering: " + offService); + } + txn.commit(); - } private void createDefaultNetworks() { diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql index 694b5e336d5..7b22cd2e55f 100755 --- a/setup/db/create-schema.sql +++ b/setup/db/create-schema.sql @@ -287,6 +287,8 @@ CREATE TABLE `cloud`.`network_offerings` ( `redundant_router_service` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if the network offering provides the redundant router service', `state` char(32) COMMENT 'state of the network offering that has Disabled value by default', `guest_type` char(32) COMMENT 'type of guest network that can be shared or isolated', + `elastic_ip_service` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if the network offering provides elastic ip service', + `elastic_lb_service` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if the network offering provides elastic lb service', PRIMARY KEY (`id`), INDEX `i_network_offerings__system_only`(`system_only`), INDEX `i_network_offerings__removed`(`removed`),