Internal Lb: added 2 boolean fields - internal_lb and public_lb - to the 
network offering. Define if internal or public LB service is supported. In the 
current release it's either one or another; in the future releases we might 
support both on the same network


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

Branch: refs/heads/internallb
Commit: b7709b89ff94a7c1eeb0e6dff0eca6220a0aed25
Parents: 014689e
Author: Alena Prokharchyk <[email protected]>
Authored: Tue Apr 16 11:04:22 2013 -0700
Committer: Alena Prokharchyk <[email protected]>
Committed: Tue Apr 16 11:33:42 2013 -0700

----------------------------------------------------------------------
 api/src/com/cloud/offering/NetworkOffering.java    |    4 +-
 server/src/com/cloud/api/ApiResponseHelper.java    |    6 ++-
 .../configuration/ConfigurationManagerImpl.java    |   48 +++++++++++----
 .../network/lb/LoadBalancingRulesManager.java      |    2 +
 .../network/lb/LoadBalancingRulesManagerImpl.java  |   17 +++++-
 .../src/com/cloud/offerings/NetworkOfferingVO.java |   33 ++++++----
 .../com/cloud/server/ConfigurationServerImpl.java  |   14 ++--
 .../lb/ApplicationLoadBalancerManagerImpl.java     |    9 ++-
 .../cloud/vpc/dao/MockNetworkOfferingDaoImpl.java  |   12 ++--
 setup/db/db/schema-410to420.sql                    |    4 +
 10 files changed, 106 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b7709b89/api/src/com/cloud/offering/NetworkOffering.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/offering/NetworkOffering.java 
b/api/src/com/cloud/offering/NetworkOffering.java
index b0f16fa..72e2a2b 100644
--- a/api/src/com/cloud/offering/NetworkOffering.java
+++ b/api/src/com/cloud/offering/NetworkOffering.java
@@ -124,6 +124,8 @@ public interface NetworkOffering extends 
InfrastructureEntity, InternalIdentity,
 
     boolean getIsPersistent();
     
-    Map getDetails();
+    boolean getInternalLb();
+
+    boolean getPublicLb();
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b7709b89/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java 
b/server/src/com/cloud/api/ApiResponseHelper.java
index 0f438ec..dd0b772 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -229,6 +229,7 @@ import com.cloud.network.vpc.Vpc;
 import com.cloud.network.vpc.VpcOffering;
 import com.cloud.offering.DiskOffering;
 import com.cloud.offering.NetworkOffering;
+import com.cloud.offering.NetworkOffering.Detail;
 import com.cloud.offering.ServiceOffering;
 import com.cloud.offerings.NetworkOfferingVO;
 import com.cloud.org.Cluster;
@@ -2227,7 +2228,10 @@ public class ApiResponseHelper implements 
ResponseGenerator {
         response.setServices(serviceResponses);
         
         //set network offering details
-        response.setDetails(_ntwkModel.getNtwkOffDetails(offering.getId()));
+        Map<Detail, String> details = 
_ntwkModel.getNtwkOffDetails(offering.getId());
+        if (details != null && !details.isEmpty()) {
+            response.setDetails(details);
+        }
         
         response.setObjectName("networkoffering");
         return response;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b7709b89/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java 
b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 2d31109..3248634 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -3371,18 +3371,20 @@ public class ConfigurationManagerImpl extends 
ManagerBase implements Configurati
         }
         
         Map<NetworkOffering.Detail, String> details = new 
HashMap<NetworkOffering.Detail, String>();
-        for (String detailStr : detailsStr.keySet()) {
-            NetworkOffering.Detail offDetail = null;
-            for (NetworkOffering.Detail supportedDetail: 
NetworkOffering.Detail.values()) {
-                if (detailStr.equalsIgnoreCase(supportedDetail.toString())) {
-                    offDetail = supportedDetail;
-                    break;
+        if (detailsStr != null) {
+            for (String detailStr : detailsStr.keySet()) {
+                NetworkOffering.Detail offDetail = null;
+                for (NetworkOffering.Detail supportedDetail: 
NetworkOffering.Detail.values()) {
+                    if 
(detailStr.equalsIgnoreCase(supportedDetail.toString())) {
+                        offDetail = supportedDetail;
+                        break;
+                    }
                 }
+                if (offDetail == null) {
+                    throw new InvalidParameterValueException("Unsupported 
detail " + detailStr);
+                }
+                details.put(offDetail, detailsStr.get(detailStr));
             }
-            if (offDetail == null) {
-                throw new InvalidParameterValueException("Unsupported detail " 
+ detailStr);
-            }
-            details.put(offDetail, detailsStr.get(detailStr));
         }
 
         return createNetworkOffering(name, displayText, trafficType, tags, 
specifyVlan, availability, networkRate, serviceProviderMap, false, guestType, 
false,
@@ -3415,8 +3417,16 @@ public class ConfigurationManagerImpl extends 
ManagerBase implements Configurati
                     if (!enabled && !disabled) {
                         throw new InvalidParameterValueException("Unknown 
specified value for " + Capability.InlineMode.getName());
                     }
+                } else if (cap == Capability.LbSchemes) {
+                    boolean internalLb = value.contains("internal");
+                    boolean publicLb = value.contains("public");
+                    if (!internalLb && !publicLb) {
+                        throw new InvalidParameterValueException("Unknown 
specified value for " + Capability.LbSchemes.getName());
+                    }
                 } else {
-                    throw new InvalidParameterValueException("Only " + 
Capability.SupportedLBIsolation.getName() + ", " + 
Capability.ElasticLb.getName() + ", " + Capability.InlineMode.getName() + " 
capabilities can be sepcified for LB service");
+                    throw new InvalidParameterValueException("Only " + 
Capability.SupportedLBIsolation.getName() + 
+                            ", " + Capability.ElasticLb.getName() + ", " + 
Capability.InlineMode.getName()
+                            + ", " + Capability.LbSchemes.getName() + " 
capabilities can be sepcified for LB service");
                 }
             }
         }
@@ -3542,6 +3552,8 @@ public class ConfigurationManagerImpl extends ManagerBase 
implements Configurati
         boolean elasticIp = false;
         boolean associatePublicIp = false;
         boolean inline = false;
+        boolean publicLb = false;
+        boolean internalLb = false;
         if (serviceCapabilityMap != null && !serviceCapabilityMap.isEmpty()) {
             Map<Capability, String> lbServiceCapabilityMap = 
serviceCapabilityMap.get(Service.Lb);
             
@@ -3566,6 +3578,18 @@ public class ConfigurationManagerImpl extends 
ManagerBase implements Configurati
                 } else {
                     inline = false;
                 }
+                
+                String publicLbStr = 
lbServiceCapabilityMap.get(Capability.LbSchemes);
+                if (serviceProviderMap.containsKey(Service.Lb)) {
+                    if (publicLbStr != null) {
+                        
_networkModel.checkCapabilityForProvider(serviceProviderMap.get(Service.Lb), 
Service.Lb, Capability.LbSchemes, publicLbStr);
+                        internalLb = publicLbStr.contains("internal");
+                        publicLb = publicLbStr.contains("public");
+                    } else {
+                        //if not specified, default public lb to true
+                        publicLb = true;
+                    }
+                }
             }
 
             Map<Capability, String> sourceNatServiceCapabilityMap = 
serviceCapabilityMap.get(Service.SourceNat);
@@ -3600,7 +3624,7 @@ public class ConfigurationManagerImpl extends ManagerBase 
implements Configurati
 
         NetworkOfferingVO offering = new NetworkOfferingVO(name, displayText, 
trafficType, systemOnly, specifyVlan, 
                 networkRate, multicastRate, isDefault, availability, tags, 
type, conserveMode, dedicatedLb,
-                sharedSourceNat, redundantRouter, elasticIp, elasticLb, 
specifyIpRanges, inline, isPersistent, associatePublicIp);
+                sharedSourceNat, redundantRouter, elasticIp, elasticLb, 
specifyIpRanges, inline, isPersistent, associatePublicIp, publicLb, internalLb);
 
         if (serviceOfferingId != null) {
             offering.setServiceOfferingId(serviceOfferingId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b7709b89/server/src/com/cloud/network/lb/LoadBalancingRulesManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/lb/LoadBalancingRulesManager.java 
b/server/src/com/cloud/network/lb/LoadBalancingRulesManager.java
index 759a77c..a23d96f 100644
--- a/server/src/com/cloud/network/lb/LoadBalancingRulesManager.java
+++ b/server/src/com/cloud/network/lb/LoadBalancingRulesManager.java
@@ -56,4 +56,6 @@ public interface LoadBalancingRulesManager extends 
LoadBalancingRulesService {
     boolean validateLbRule(LoadBalancingRule lbRule);
 
     void removeLBRule(LoadBalancer rule);
+
+    void isLbServiceSupportedInNetwork(long networkId, Scheme scheme);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b7709b89/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java 
b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
index 1b9cc12..676578a 100755
--- a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
+++ b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
@@ -2068,7 +2068,8 @@ public class LoadBalancingRulesManagerImpl<Type> extends 
ManagerBase implements
         return dstList;
     }
     
-    protected void isLbServiceSupportedInNetwork(long networkId, Scheme 
scheme) {
+    @Override
+    public void isLbServiceSupportedInNetwork(long networkId, Scheme scheme) {
         Network network = _networkDao.findById(networkId);
         
         //1) Check if the LB service is supported
@@ -2079,7 +2080,19 @@ public class LoadBalancingRulesManagerImpl<Type> extends 
ManagerBase implements
             throw ex;
         }
         
-        //2) Check if the provider supports the scheme
+        //2) Check if the Scheme is supported\
+        NetworkOffering off = 
_configMgr.getNetworkOffering(network.getNetworkOfferingId());
+        if (scheme == Scheme.Public) {
+            if (!off.getPublicLb()) {
+                throw new InvalidParameterValueException("Scheme " + scheme + 
" is not supported by the network offering " + off);
+            }
+        } else {
+            if (!off.getInternalLb()) {
+                throw new InvalidParameterValueException("Scheme " + scheme + 
" is not supported by the network offering " + off);    
+            }
+        }
+        
+        //3) Check if the provider supports the scheme
         LoadBalancingServiceProvider lbProvider = 
_networkMgr.getLoadBalancingProviderForNetwork(network, scheme);
         if (lbProvider == null) {
             throw new InvalidParameterValueException("Lb rule with scheme " + 
scheme.toString() + " is not supported by lb providers in network " + network);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b7709b89/server/src/com/cloud/offerings/NetworkOfferingVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/offerings/NetworkOfferingVO.java 
b/server/src/com/cloud/offerings/NetworkOfferingVO.java
index 359748f..3ae0bf3 100755
--- a/server/src/com/cloud/offerings/NetworkOfferingVO.java
+++ b/server/src/com/cloud/offerings/NetworkOfferingVO.java
@@ -17,7 +17,6 @@
 package com.cloud.offerings;
 
 import java.util.Date;
-import java.util.Map;
 import java.util.UUID;
 
 import javax.persistence.Column;
@@ -28,7 +27,6 @@ import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Table;
-import javax.persistence.Transient;
 
 import com.cloud.network.Network;
 import com.cloud.network.Networks.TrafficType;
@@ -137,8 +135,11 @@ public class NetworkOfferingVO implements NetworkOffering {
         return displayText;
     }
     
-    @Transient
-    Map details;
+    @Column(name = "internal_lb")
+    boolean internalLb;
+    
+    @Column(name = "public_lb")
+    boolean publicLb;
 
     @Override
     public long getId() {
@@ -275,7 +276,7 @@ public class NetworkOfferingVO implements NetworkOffering {
     }
 
     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 specifyIpRanges, boolean isPersistent) 
{
+            Availability availability, String tags, Network.GuestType 
guestType, boolean conserveMode, boolean specifyIpRanges, boolean isPersistent, 
boolean internalLb, boolean publicLb) {
         this.name = name;
         this.displayText = displayText;
         this.rateMbps = rateMbps;
@@ -299,12 +300,14 @@ public class NetworkOfferingVO implements NetworkOffering 
{
         this.inline = false;
         this.specifyIpRanges = specifyIpRanges;
         this.isPersistent=isPersistent;
+        this.publicLb = publicLb;
+        this.internalLb = internalLb;
     }
 
     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, boolean elasticIp, boolean elasticLb,
-            boolean specifyIpRanges, boolean inline, boolean isPersistent, 
boolean associatePublicIP) {
-        this(name, displayText, trafficType, systemOnly, specifyVlan, 
rateMbps, multicastRateMbps, isDefault, availability, tags, guestType, 
conserveMode, specifyIpRanges, isPersistent);
+            boolean specifyIpRanges, boolean inline, boolean isPersistent, 
boolean associatePublicIP, boolean publicLb, boolean internalLb) {
+        this(name, displayText, trafficType, systemOnly, specifyVlan, 
rateMbps, multicastRateMbps, isDefault, availability, tags, guestType, 
conserveMode, specifyIpRanges, isPersistent, internalLb, publicLb);
         this.dedicatedLB = dedicatedLb;
         this.sharedSourceNat = sharedSourceNat;
         this.redundantRouter = redundantRouter;
@@ -326,13 +329,13 @@ public class NetworkOfferingVO implements NetworkOffering 
{
      *            TODO
      */
     public NetworkOfferingVO(String name, TrafficType trafficType, boolean 
specifyIpRanges) {
-        this(name, "System Offering for " + name, trafficType, true, false, 0, 
0, true, Availability.Required, null, null, true, specifyIpRanges, false);
+        this(name, "System Offering for " + name, trafficType, true, false, 0, 
0, true, Availability.Required, null, null, true, specifyIpRanges, false, 
false, false);
         this.state = State.Enabled;
     }
 
     public NetworkOfferingVO(String name, Network.GuestType guestType) {
         this(name, "System Offering for " + name, TrafficType.Guest, true, 
true, 0, 0, true, Availability.Optional,
-                null, Network.GuestType.Isolated, true, false, false);
+                null, Network.GuestType.Isolated, true, false, false, false, 
false);
         this.state = State.Enabled;
     }
 
@@ -400,9 +403,15 @@ public class NetworkOfferingVO implements NetworkOffering {
     public boolean getIsPersistent() {
         return isPersistent;
     }
-    
-    public Map getDetails() {
-        return this.details;
+
+    @Override
+    public boolean getInternalLb() {
+        return internalLb;
+    }
+
+    @Override
+    public boolean getPublicLb() {
+        return publicLb;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b7709b89/server/src/com/cloud/server/ConfigurationServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java 
b/server/src/com/cloud/server/ConfigurationServerImpl.java
index 852c00b..d4a7417 100755
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@ -939,7 +939,7 @@ public class ConfigurationServerImpl extends ManagerBase 
implements Configuratio
                 "Offering for Shared Security group enabled networks",
                 TrafficType.Guest,
                 false, true, null, null, true, Availability.Optional,
-                null, Network.GuestType.Shared, true, true, false);
+                null, Network.GuestType.Shared, true, true, false, false, 
false);
 
         defaultSharedSGNetworkOffering.setState(NetworkOffering.State.Enabled);
         defaultSharedSGNetworkOffering = 
_networkOfferingDao.persistDefaultNetworkOffering(defaultSharedSGNetworkOffering);
@@ -956,7 +956,7 @@ public class ConfigurationServerImpl extends ManagerBase 
implements Configuratio
                 "Offering for Shared networks",
                 TrafficType.Guest,
                 false, true, null, null, true, Availability.Optional,
-                null, Network.GuestType.Shared, true, true, false);
+                null, Network.GuestType.Shared, true, true, false, false, 
false);
 
         defaultSharedNetworkOffering.setState(NetworkOffering.State.Enabled);
         defaultSharedNetworkOffering = 
_networkOfferingDao.persistDefaultNetworkOffering(defaultSharedNetworkOffering);
@@ -973,7 +973,7 @@ public class ConfigurationServerImpl extends ManagerBase 
implements Configuratio
                 "Offering for Isolated networks with Source Nat service 
enabled",
                 TrafficType.Guest,
                 false, false, null, null, true, Availability.Required,
-                null, Network.GuestType.Isolated, true, false, false);
+                null, Network.GuestType.Isolated, true, false, false, false, 
true);
 
         
defaultIsolatedSourceNatEnabledNetworkOffering.setState(NetworkOffering.State.Enabled);
         defaultIsolatedSourceNatEnabledNetworkOffering = 
_networkOfferingDao.persistDefaultNetworkOffering(defaultIsolatedSourceNatEnabledNetworkOffering);
@@ -991,7 +991,7 @@ public class ConfigurationServerImpl extends ManagerBase 
implements Configuratio
                 "Offering for Isolated networks with no Source Nat service",
                 TrafficType.Guest,
                 false, true, null, null, true, Availability.Optional,
-                null, Network.GuestType.Isolated, true, true, false);
+                null, Network.GuestType.Isolated, true, true, false, false, 
false);
 
         
defaultIsolatedEnabledNetworkOffering.setState(NetworkOffering.State.Enabled);
         defaultIsolatedEnabledNetworkOffering = 
_networkOfferingDao.persistDefaultNetworkOffering(defaultIsolatedEnabledNetworkOffering);
@@ -1008,7 +1008,7 @@ public class ConfigurationServerImpl extends ManagerBase 
implements Configuratio
                 "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, true, false, false, true);
+                null, Network.GuestType.Shared, true, false, false, false, 
true, true, true, false, false, true, true, false);
 
         
defaultNetscalerNetworkOffering.setState(NetworkOffering.State.Enabled);
         defaultNetscalerNetworkOffering = 
_networkOfferingDao.persistDefaultNetworkOffering(defaultNetscalerNetworkOffering);
@@ -1025,7 +1025,7 @@ public class ConfigurationServerImpl extends ManagerBase 
implements Configuratio
                 "Offering for Isolated Vpc networks with Source Nat service 
enabled",
                 TrafficType.Guest,
                 false, false, null, null, true, Availability.Optional,
-                null, Network.GuestType.Isolated, false, false, false);
+                null, Network.GuestType.Isolated, false, false, false, false, 
true);
 
         
defaultNetworkOfferingForVpcNetworks.setState(NetworkOffering.State.Enabled);
         defaultNetworkOfferingForVpcNetworks = 
_networkOfferingDao.persistDefaultNetworkOffering(defaultNetworkOfferingForVpcNetworks);
@@ -1055,7 +1055,7 @@ public class ConfigurationServerImpl extends ManagerBase 
implements Configuratio
                 "Offering for Isolated Vpc networks with Source Nat service 
enabled and LB service Disabled",
                 TrafficType.Guest,
                 false, false, null, null, true, Availability.Optional,
-                null, Network.GuestType.Isolated, false, false, false);
+                null, Network.GuestType.Isolated, false, false, false, false, 
false);
 
         
defaultNetworkOfferingForVpcNetworksNoLB.setState(NetworkOffering.State.Enabled);
         defaultNetworkOfferingForVpcNetworksNoLB = 
_networkOfferingDao.persistDefaultNetworkOffering(defaultNetworkOfferingForVpcNetworksNoLB);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b7709b89/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
 
b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
index 46cef7c..ca7b851 100644
--- 
a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
+++ 
b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
@@ -126,19 +126,24 @@ public class ApplicationLoadBalancerManagerImpl extends 
ManagerBase implements A
         //1) Validate LB rule's parameters
         validateLbRule(sourcePort, instancePort, algorithm, guestNtwk, scheme);
         
-        //2) Get source ip address
+        //2) verify that lb service is supported by the network
+        _lbMgr.isLbServiceSupportedInNetwork(guestNtwk.getId(), scheme);
+        
+        //3) Get source ip address
         sourceIp = getSourceIp(scheme, sourceIpNtwk, sourceIp);
                
         ApplicationLoadBalancerRuleVO newRule = new 
ApplicationLoadBalancerRuleVO(name, description, sourcePort, instancePort, 
algorithm, guestNtwk.getId(),
                 lbOwner.getId(), lbOwner.getDomainId(), new Ip(sourceIp), 
sourceIpNtwk.getId(), scheme);
         
-        //3) Validate Load Balancing rule on the providers
+        //4) Validate Load Balancing rule on the providers
         LoadBalancingRule loadBalancing = new LoadBalancingRule(newRule, new 
ArrayList<LbDestination>(),
                 new ArrayList<LbStickinessPolicy>(), new 
ArrayList<LbHealthCheckPolicy>(), new Ip(sourceIp));
         if (!_lbMgr.validateLbRule(loadBalancing)) {
             throw new InvalidParameterValueException("LB service provider 
cannot support this rule");
         }
         
+        
+        
 
         //4) Persist Load Balancer rule
         return persistLbRule(newRule, sourceIp, guestNtwk);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b7709b89/server/test/com/cloud/vpc/dao/MockNetworkOfferingDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/dao/MockNetworkOfferingDaoImpl.java 
b/server/test/com/cloud/vpc/dao/MockNetworkOfferingDaoImpl.java
index dbf1411..a8208dd 100644
--- a/server/test/com/cloud/vpc/dao/MockNetworkOfferingDaoImpl.java
+++ b/server/test/com/cloud/vpc/dao/MockNetworkOfferingDaoImpl.java
@@ -101,28 +101,28 @@ public class MockNetworkOfferingDaoImpl extends 
NetworkOfferingDaoImpl implement
         if (id.longValue() == 1) {
             //network offering valid for vpc
             vo = new NetworkOfferingVO("vpc", "vpc", TrafficType.Guest, false, 
true, null, null, false,
-                    Availability.Optional, null, Network.GuestType.Isolated, 
false, false, false);
+                    Availability.Optional, null, Network.GuestType.Isolated, 
false, false, false, false, false);
         } else if (id.longValue() == 2) {
             //invalid offering - source nat is not included
             vo = new NetworkOfferingVO("vpc", "vpc", TrafficType.Guest, false, 
true, null, null, false,
-                    Availability.Optional, null, Network.GuestType.Isolated, 
false, false, false);
+                    Availability.Optional, null, Network.GuestType.Isolated, 
false, false, false, false, false);
         } else if (id.longValue() == 3) {
             //network offering invalid for vpc (conserve mode off)
             vo = new NetworkOfferingVO("non vpc", "non vpc", 
TrafficType.Guest, false, true, null, null, false,
-                    Availability.Optional, null, Network.GuestType.Isolated, 
true, false, false);
+                    Availability.Optional, null, Network.GuestType.Isolated, 
true, false, false, false, false);
         } else if (id.longValue() == 4) {
             //network offering invalid for vpc (Shared)
             vo = new NetworkOfferingVO("non vpc", "non vpc", 
TrafficType.Guest, false, true, null, null, false,
-                    Availability.Optional, null, Network.GuestType.Shared, 
false, false, false);
+                    Availability.Optional, null, Network.GuestType.Shared, 
false, false, false, false, false);
         } else if (id.longValue() == 5) {
             //network offering invalid for vpc (has redundant router)
             vo = new NetworkOfferingVO("vpc", "vpc", TrafficType.Guest, false, 
true, null, null, false,
-                    Availability.Optional, null, Network.GuestType.Isolated, 
false, false, false);
+                    Availability.Optional, null, Network.GuestType.Isolated, 
false, false, false, false, false);
             vo.setRedundantRouter(true);
         } else if (id.longValue() == 6) {
             //network offering invalid for vpc (has lb service)   
             vo = new NetworkOfferingVO("vpc", "vpc", TrafficType.Guest, false, 
true, null, null, false,
-                    Availability.Optional, null, Network.GuestType.Isolated, 
false, false, false);
+                    Availability.Optional, null, Network.GuestType.Isolated, 
false, false, false, false, false);
         }
         
         if (vo != null) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b7709b89/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index c22d555..1d8a6f1 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -852,3 +852,7 @@ ALTER TABLE `cloud`.`ntwk_service_map` DROP INDEX 
`network_id`;
 ALTER TABLE `cloud`.`ntwk_service_map` ADD UNIQUE `network_id` 
(`network_id`,`service`,`provider`);
 ALTER TABLE `cloud`.`ntwk_service_map` ADD  CONSTRAINT 
`fk_ntwk_service_map__network_id` FOREIGN KEY (`network_id`) REFERENCES 
`networks` (`id`) ON DELETE CASCADE;
 
+
+ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `internal_lb` int(1) 
unsigned NOT NULL DEFAULT '0' COMMENT 'true if the network offering supports 
Internal lb service';
+ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `public_lb` int(1) unsigned 
NOT NULL DEFAULT '0' COMMENT 'true if the network offering supports Public lb 
service';
+UPDATE `cloud`.`network_offerings` SET public_lb=1 where id IN (SELECT 
DISTINCT network_offering_id FROM `cloud`.`ntwk_offering_service_map` WHERE 
service='Lb');
\ No newline at end of file

Reply via email to