You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ta...@apache.org on 2014/04/08 14:25:53 UTC
[38/60] [abbrv] git commit: updated refs/heads/marvin to 0e223d6
internal lb support for contrail vpc
Signed-off-by: Alena Prokharchyk <al...@citrix.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0560254c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0560254c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0560254c
Branch: refs/heads/marvin
Commit: 0560254c04425705530a23a93002daede4b6dc3c
Parents: 781b7ee
Author: sbalineni <sb...@contrailsystems.com>
Authored: Tue Mar 11 18:28:33 2014 +0000
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Fri Apr 4 15:36:09 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/0560254c/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 f32d5da..8e9866f 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/0560254c/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/0560254c/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 80e4eda..f53eb1f 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -1277,7 +1277,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);
}
}