Skip to content

Commit

Permalink
Update 8772: fix Fail to add a provider to physical network
Browse files Browse the repository at this point in the history
  • Loading branch information
weizhouapache committed Mar 12, 2024
1 parent 6c07f33 commit bea790f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server/src/main/java/com/cloud/network/NetworkServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -4109,7 +4109,13 @@ public PhysicalNetworkVO doInTransaction(TransactionStatus status) {

// Add the config drive provider
addConfigDriveToPhysicalNetwork(pNetwork.getId());
addNSXProviderToPhysicalNetwork(pNetwork.getId());

// Add NSX provider
try {
addNSXProviderToPhysicalNetwork(pNetwork.getId());
} catch (Exception ex) {
logger.warn("Failed to add NSX provider to physical network due to:", ex.getMessage());
}

CallContext.current().putContextParameter(PhysicalNetwork.class, pNetwork.getUuid());

Expand Down Expand Up @@ -5510,7 +5516,7 @@ private PhysicalNetworkServiceProvider addNSXProviderToPhysicalNetwork(long phys
DataCenterVO dvo = _dcDao.findById(pvo.getDataCenterId());
if (dvo.getNetworkType() == NetworkType.Advanced) {

Provider provider = Network.Provider.getProvider("Nsx");
Provider provider = Network.Provider.getProvider(Provider.Nsx.getName());
if (provider == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1430,6 +1430,9 @@ private boolean checkAndUpdateRouterSourceNatIp(Vpc vpc, String sourceNatIp) {
_ipAddrMgr.updateSourceNatIpAddress(requestedIp, userIps);
if (isVpcForNsx(vpc)) {
VpcProvider nsxElement = (VpcProvider) _ntwkModel.getElementImplementingProvider(Provider.Nsx.getName());
if (nsxElement == null) {
return true;
}
nsxElement.updateVpcSourceNatIp(vpc, requestedIp);
// The NSX source NAT IP change does not require to update the VPC VR
return false;
Expand Down

0 comments on commit bea790f

Please sign in to comment.