mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
internal lb support for contrail vpc
Signed-off-by: Alena Prokharchyk <alena.prokharchyk@citrix.com>
This commit is contained in:
parent
781b7eec3f
commit
0560254c04
@ -54,7 +54,6 @@
|
|||||||
<groupId>org.apache.cloudstack</groupId>
|
<groupId>org.apache.cloudstack</groupId>
|
||||||
<artifactId>cloud-plugin-network-internallb</artifactId>
|
<artifactId>cloud-plugin-network-internallb</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.cloudstack</groupId>
|
<groupId>org.apache.cloudstack</groupId>
|
||||||
|
|||||||
@ -241,8 +241,16 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager
|
|||||||
Map<Service, Set<Provider>> serviceProviderMap = new HashMap<Service, Set<Provider>>();
|
Map<Service, Set<Provider>> serviceProviderMap = new HashMap<Service, Set<Provider>>();
|
||||||
Set<Provider> providerSet = new HashSet<Provider>();
|
Set<Provider> providerSet = new HashSet<Provider>();
|
||||||
providerSet.add(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) {
|
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);
|
serviceProviderMap.put(svc, providerSet);
|
||||||
}
|
}
|
||||||
ConfigurationManager configMgr = (ConfigurationManager)_configService;
|
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);
|
Network.GuestType.Isolated, false, null, false, null, false, true, null, true, null, false);
|
||||||
|
|
||||||
voffer.setState(NetworkOffering.State.Enabled);
|
voffer.setState(NetworkOffering.State.Enabled);
|
||||||
|
if (offeringName.equals(vpcRouterOfferingName)) {
|
||||||
|
voffer.setInternalLb(true);
|
||||||
|
}
|
||||||
long id = voffer.getId();
|
long id = voffer.getId();
|
||||||
_networkOfferingDao.update(id, voffer);
|
_networkOfferingDao.update(id, voffer);
|
||||||
return _networkOfferingDao.findById(id);
|
return _networkOfferingDao.findById(id);
|
||||||
@ -277,8 +288,15 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager
|
|||||||
services.add(Service.StaticNat.getName());
|
services.add(Service.StaticNat.getName());
|
||||||
services.add(Service.SourceNat.getName());
|
services.add(Service.SourceNat.getName());
|
||||||
services.add(Service.Gateway.getName());
|
services.add(Service.Gateway.getName());
|
||||||
|
services.add(Service.Lb.getName());
|
||||||
|
|
||||||
for (String svc: services) {
|
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);
|
serviceProviderMap.put(svc, providerSet);
|
||||||
}
|
}
|
||||||
vpcOffer = _vpcProvSvc.createVpcOffering(juniperVPCOfferingName, juniperVPCOfferingDisplayText, services, serviceProviderMap, null, null);
|
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);
|
_controller = new ModelController(this, _api, _vmDao, _networksDao, _nicDao, _vlanDao, _ipAddressDao);
|
||||||
|
try {
|
||||||
_routerOffering = locateNetworkOffering(routerOfferingName, routerOfferingDisplayText,
|
_routerOffering = locateNetworkOffering(routerOfferingName, routerOfferingDisplayText,
|
||||||
Provider.JuniperContrailRouter);
|
Provider.JuniperContrailRouter);
|
||||||
_routerPublicOffering = locatePublicNetworkOffering(routerPublicOfferingName, routerPublicOfferingDisplayText,
|
_routerPublicOffering = locatePublicNetworkOffering(routerPublicOfferingName, routerPublicOfferingDisplayText,
|
||||||
Provider.JuniperContrailRouter);
|
Provider.JuniperContrailRouter);
|
||||||
_vpcRouterOffering = locateNetworkOffering(vpcRouterOfferingName, vpcRouterOfferingDisplayText,
|
_vpcRouterOffering = locateNetworkOffering(vpcRouterOfferingName, vpcRouterOfferingDisplayText,
|
||||||
Provider.JuniperContrailVpcRouter);
|
Provider.JuniperContrailVpcRouter);
|
||||||
_vpcOffering = locateVpcOffering();
|
_vpcOffering = locateVpcOffering();
|
||||||
|
}catch (Exception ex) {
|
||||||
|
s_logger.debug("Exception in locating network offerings: " + ex);
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new ConfigurationException();
|
||||||
|
}
|
||||||
|
|
||||||
_eventHandler.subscribe();
|
_eventHandler.subscribe();
|
||||||
|
|
||||||
@ -532,7 +555,8 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager
|
|||||||
List<PhysicalNetworkVO> net_list = _physicalNetworkDao.listByZone(network.getDataCenterId());
|
List<PhysicalNetworkVO> net_list = _physicalNetworkDao.listByZone(network.getDataCenterId());
|
||||||
for (PhysicalNetworkVO phys : net_list) {
|
for (PhysicalNetworkVO phys : net_list) {
|
||||||
if(_physProviderDao.findByServiceProvider(phys.getId(), Provider.JuniperContrailRouter.getName()) != null ||
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1277,7 +1277,9 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
|
|||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
NetworkOffering otherOff = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId());
|
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);
|
throw new InvalidParameterValueException("Public LB service is already supported " + "by network " + network + " in VPC " + vpc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user