You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pe...@apache.org on 2024/01/26 15:35:59 UTC
(cloudstack) 03/05: NSX: VPC route mode
This is an automated email from the ASF dual-hosted git repository.
pearl11594 pushed a commit to branch nsx-vpc-routed-mode
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
commit 1c228a4a59eb915bc43681bacf1d7c88c8f2210c
Author: Pearl Dsilva <pe...@gmail.com>
AuthorDate: Fri Jan 26 09:27:43 2024 -0500
NSX: VPC route mode
---
.../java/org/apache/cloudstack/service/NsxGuestNetworkGuru.java | 5 ++++-
.../java/org/apache/cloudstack/service/NsxPublicNetworkGuru.java | 6 +++++-
ui/src/views/network/VpcTiersTab.vue | 8 +-------
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxGuestNetworkGuru.java b/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxGuestNetworkGuru.java
index 9c153283b80..1482f8fdc6f 100644
--- a/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxGuestNetworkGuru.java
+++ b/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxGuestNetworkGuru.java
@@ -319,7 +319,10 @@ public class NsxGuestNetworkGuru extends GuestNetworkGuru implements NetworkMigr
vpcName = vpc.getName();
} else {
LOGGER.debug(String.format("Creating a Tier 1 Gateway for the network %s before creating the NSX segment", networkVO.getName()));
- boolean isSourceNatSupported = networkOfferingServiceMapDao.areServicesSupportedByNetworkOffering(networkVO.getNetworkOfferingId(), Network.Service.SourceNat);
+ long networkOfferingId = networkVO.getNetworkOfferingId();
+ NetworkOfferingVO networkOfferingVO = networkOfferingDao.findById(networkOfferingId);
+ boolean isSourceNatSupported = !NetworkOffering.NsxMode.ROUTED.name().equals(networkOfferingVO.getNsxMode()) &&
+ networkOfferingServiceMapDao.areServicesSupportedByNetworkOffering(networkVO.getNetworkOfferingId(), Network.Service.SourceNat);
CreateNsxTier1GatewayCommand nsxTier1GatewayCommand = new CreateNsxTier1GatewayCommand(domain.getId(), account.getId(), zone.getId(), networkVO.getId(), networkVO.getName(), false, isSourceNatSupported);
NsxAnswer nsxAnswer = nsxControllerUtils.sendNsxCommand(nsxTier1GatewayCommand, zone.getId());
diff --git a/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxPublicNetworkGuru.java b/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxPublicNetworkGuru.java
index 2e8127526b3..1b92a694317 100644
--- a/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxPublicNetworkGuru.java
+++ b/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxPublicNetworkGuru.java
@@ -29,6 +29,7 @@ import com.cloud.network.dao.IPAddressVO;
import com.cloud.network.dao.NetworkVO;
import com.cloud.network.guru.PublicNetworkGuru;
import com.cloud.network.vpc.VpcOffering;
+import com.cloud.network.vpc.VpcOfferingVO;
import com.cloud.network.vpc.VpcVO;
import com.cloud.network.vpc.dao.VpcDao;
import com.cloud.network.vpc.dao.VpcOfferingDao;
@@ -129,7 +130,10 @@ public class NsxPublicNetworkGuru extends PublicNetworkGuru {
long dataCenterId = vpc.getZoneId();
long resourceId = vpc.getId();
Network.Service[] services = { Network.Service.SourceNat };
- boolean sourceNatEnabled = vpcOfferingServiceMapDao.areServicesSupportedByVpcOffering(vpc.getVpcOfferingId(), services);
+ long networkOfferingId = vpc.getVpcOfferingId();
+ VpcOfferingVO vpcVO = vpcOfferingDao.findById(networkOfferingId);
+ boolean sourceNatEnabled = !NetworkOffering.NsxMode.ROUTED.name().equals(vpcVO.getNsxMode()) &&
+ vpcOfferingServiceMapDao.areServicesSupportedByVpcOffering(vpc.getVpcOfferingId(), services);
s_logger.info(String.format("Creating Tier 1 Gateway for VPC %s", vpc.getName()));
boolean result = nsxService.createVpcNetwork(dataCenterId, accountId, domainId, resourceId, vpc.getName(), sourceNatEnabled);
diff --git a/ui/src/views/network/VpcTiersTab.vue b/ui/src/views/network/VpcTiersTab.vue
index 5742cdf1341..8f062ddd0aa 100644
--- a/ui/src/views/network/VpcTiersTab.vue
+++ b/ui/src/views/network/VpcTiersTab.vue
@@ -461,14 +461,8 @@ export default {
this.form = reactive({})
this.rules = reactive({})
},
-<<<<<<< Updated upstream
showIlb (network) {
- return network.service.filter(s => (s.name === 'Lb') && (s.capability.filter(c => c.name === 'LbSchemes' && c.value === 'Internal').length > 0)).length > 0 || false
-=======
- async showIlb (network) {
- const networkOffering = await this.getNetworkOffering(network.networkofferingid)
- return ((networkOffering.supportsinternallb && network.service.filter(s => (s.name === 'Lb') && (s.capability.filter(c => c.name === 'LbSchemes' && c.value.split(',').includes('Internal')).length > 0)).length > 0))
->>>>>>> Stashed changes
+ return network.service.filter(s => (s.name === 'Lb') && (s.capability.filter(c => c.name === 'LbSchemes' && c.value.split(',').includes('Internal')).length > 0)).length > 0 || false
},
updateMtu () {
if (this.form.privatemtu > this.privateMtuMax) {