cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject git commit: updated refs/heads/4.4 to 00f0d9b
Date Fri, 04 Apr 2014 22:45:02 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4 51fcecca2 -> 00f0d9b3c


internal lb support for contrail vpc

Signed-off-by: Alena Prokharchyk <alena.prokharchyk@citrix.com>


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

Branch: refs/heads/4.4
Commit: 00f0d9b3c87eeb343f54e48e101861e4b8fe2acb
Parents: 51fcecc
Author: sbalineni <sbalineni@contrailsystems.com>
Authored: Tue Mar 11 18:28:33 2014 +0000
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Fri Apr 4 15:35:58 2014 -0700

----------------------------------------------------------------------
 .../network-elements/juniper-contrail/pom.xml   |  1 -
 .../management/ContrailManagerImpl.java         | 44 +++++++++++++++-----
 .../com/cloud/network/vpc/VpcManagerImpl.java   |  4 +-
 3 files changed, 37 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/00f0d9b3/plugins/network-elements/juniper-contrail/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/juniper-contrail/pom.xml b/plugins/network-elements/juniper-contrail/pom.xml
index 8c6877d..6f132e5 100644
--- a/plugins/network-elements/juniper-contrail/pom.xml
+++ b/plugins/network-elements/juniper-contrail/pom.xml
@@ -54,7 +54,6 @@
       <groupId>org.apache.cloudstack</groupId>
       <artifactId>cloud-plugin-network-internallb</artifactId>
       <version>${project.version}</version>
-      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.cloudstack</groupId>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/00f0d9b3/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ContrailManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ContrailManagerImpl.java
b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ContrailManagerImpl.java
index bf083fd..cc87aa5 100644
--- a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ContrailManagerImpl.java
+++ b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ContrailManagerImpl.java
@@ -241,8 +241,16 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager
         Map<Service, Set<Provider>> serviceProviderMap = new HashMap<Service,
Set<Provider>>();
         Set<Provider> providerSet = new HashSet<Provider>();
         providerSet.add(provider);
-        final Service[] services = {Service.Connectivity, Service.Dhcp, Service.NetworkACL,
Service.StaticNat, Service.SourceNat};
+        final Service[] services = {Service.Connectivity, Service.Dhcp, Service.NetworkACL,
Service.StaticNat, Service.SourceNat, Service.Lb};
         for (Service svc : services) {
+            if (svc == Service.Lb) {
+                if(offeringName.equals(vpcRouterOfferingName)) {
+                    Set<Provider> lbProviderSet = new HashSet<Provider>();
+                    lbProviderSet.add(Provider.InternalLbVm);
+                    serviceProviderMap.put(svc, lbProviderSet);
+                }
+                continue;
+            }
             serviceProviderMap.put(svc, providerSet);
         }
         ConfigurationManager configMgr = (ConfigurationManager)_configService;
@@ -251,6 +259,9 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager
                         Network.GuestType.Isolated, false, null, false, null, false, true,
null, true, null, false);
 
         voffer.setState(NetworkOffering.State.Enabled);
+        if (offeringName.equals(vpcRouterOfferingName)) {
+            voffer.setInternalLb(true);
+        }
         long id = voffer.getId();
         _networkOfferingDao.update(id, voffer);
         return _networkOfferingDao.findById(id);
@@ -277,8 +288,15 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager
         services.add(Service.StaticNat.getName());
         services.add(Service.SourceNat.getName());
         services.add(Service.Gateway.getName());
+        services.add(Service.Lb.getName());
 
         for (String svc: services) {
+            if (svc.equals(Service.Lb.getName())) {
+                List<String> lbProviderSet = new ArrayList<String>();
+                lbProviderSet.add(Provider.InternalLbVm.getName());
+                serviceProviderMap.put(svc, lbProviderSet);
+                continue;
+            }
             serviceProviderMap.put(svc, providerSet);
         }
         vpcOffer = _vpcProvSvc.createVpcOffering(juniperVPCOfferingName, juniperVPCOfferingDisplayText,
services, serviceProviderMap, null, null);
@@ -333,14 +351,19 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager
         }
 
         _controller = new ModelController(this, _api, _vmDao, _networksDao, _nicDao, _vlanDao,
_ipAddressDao);
-
-        _routerOffering = locateNetworkOffering(routerOfferingName, routerOfferingDisplayText,
-                Provider.JuniperContrailRouter);
-        _routerPublicOffering = locatePublicNetworkOffering(routerPublicOfferingName, routerPublicOfferingDisplayText,
-                Provider.JuniperContrailRouter);
-        _vpcRouterOffering = locateNetworkOffering(vpcRouterOfferingName, vpcRouterOfferingDisplayText,
-                Provider.JuniperContrailVpcRouter);
-        _vpcOffering = locateVpcOffering();
+        try {
+            _routerOffering = locateNetworkOffering(routerOfferingName, routerOfferingDisplayText,
+                    Provider.JuniperContrailRouter);
+            _routerPublicOffering = locatePublicNetworkOffering(routerPublicOfferingName,
routerPublicOfferingDisplayText,
+                    Provider.JuniperContrailRouter);
+            _vpcRouterOffering = locateNetworkOffering(vpcRouterOfferingName, vpcRouterOfferingDisplayText,
+                    Provider.JuniperContrailVpcRouter);
+            _vpcOffering = locateVpcOffering();
+        }catch (Exception ex) {
+            s_logger.debug("Exception in locating network offerings: " + ex);
+            ex.printStackTrace();
+            throw new ConfigurationException();
+        }
 
         _eventHandler.subscribe();
 
@@ -532,7 +555,8 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager
         List<PhysicalNetworkVO> net_list = _physicalNetworkDao.listByZone(network.getDataCenterId());
         for (PhysicalNetworkVO phys : net_list) {
             if(_physProviderDao.findByServiceProvider(phys.getId(), Provider.JuniperContrailRouter.getName())
!= null ||
-                    _physProviderDao.findByServiceProvider(phys.getId(), Provider.JuniperContrailVpcRouter.getName())
!= null) {
+                    _physProviderDao.findByServiceProvider(phys.getId(), Provider.JuniperContrailVpcRouter.getName())
!= null ||
+                    _physProviderDao.findByServiceProvider(phys.getId(), Provider.InternalLbVm.getName())
!= null) {
                 return true;
             }
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/00f0d9b3/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index 7e1ba96..c517fb1 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -1279,7 +1279,9 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager,
VpcProvis
                     continue;
                 } else {
                     NetworkOffering otherOff = _entityMgr.findById(NetworkOffering.class,
network.getNetworkOfferingId());
-                    if (_ntwkModel.areServicesSupportedInNetwork(network.getId(), Service.Lb)
&& otherOff.getPublicLb()) {
+                    //throw only if networks have different offerings with public lb support
+                    if (_ntwkModel.areServicesSupportedInNetwork(network.getId(), Service.Lb)
&& otherOff.getPublicLb() &&
+                                   guestNtwkOff.getId() != otherOff.getId()) {
                         throw new InvalidParameterValueException("Public LB service is already
supported " + "by network " + network + " in VPC " + vpc);
                     }
                 }


Mime
View raw message