This commit is contained in:
Wei Zhou 2026-01-22 15:15:42 +01:00 committed by GitHub
commit c9b0b02fe0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 2 deletions

View File

@ -177,4 +177,6 @@ public interface VpcManager {
* @return
*/
boolean isSrcNatIpRequired(long vpcOfferingId);
boolean isSrcNatIpRequiredForVpcVr(long vpcOfferingId);
}

View File

@ -3400,6 +3400,15 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
&& vpcOffSvcProvidersMap.get(Service.Gateway).contains(Network.Provider.VPCVirtualRouter));
}
@Override
public boolean isSrcNatIpRequiredForVpcVr(long vpcOfferingId) {
final Map<Network.Service, Set<Network.Provider>> vpcOffSvcProvidersMap = getVpcOffSvcProvidersMap(vpcOfferingId);
return (Objects.nonNull(vpcOffSvcProvidersMap.get(Network.Service.SourceNat))
&& vpcOffSvcProvidersMap.get(Network.Service.SourceNat).contains(Network.Provider.VPCVirtualRouter))
|| (Objects.nonNull(vpcOffSvcProvidersMap.get(Network.Service.Gateway))
&& vpcOffSvcProvidersMap.get(Service.Gateway).contains(Network.Provider.VPCVirtualRouter));
}
/**
* rollingRestartVpc performs restart of routers of a VPC by first
* deploying a new VR and then destroying old VRs in rolling fashion. For

View File

@ -111,7 +111,7 @@ public class VpcRouterDeploymentDefinition extends RouterDeploymentDefinition {
@Override
protected boolean prepareDeployment() {
//Check if the VR is the src NAT provider...
isPublicNetwork = vpcMgr.isSrcNatIpRequired(vpc.getVpcOfferingId());
isPublicNetwork = vpcMgr.isSrcNatIpRequiredForVpcVr(vpc.getVpcOfferingId());
// Check if public network has to be set on VR
return true;

View File

@ -173,7 +173,7 @@ public class VpcRouterDeploymentDefinitionTest extends RouterDeploymentDefinitio
protected void driveTestPrepareDeployment(final boolean isRedundant, final boolean isPublicNw) {
// Prepare
when(vpcMgr.isSrcNatIpRequired(mockVpc.getVpcOfferingId())).thenReturn(isPublicNw);
when(vpcMgr.isSrcNatIpRequiredForVpcVr(mockVpc.getVpcOfferingId())).thenReturn(isPublicNw);
// Execute
final boolean canProceedDeployment = deployment.prepareDeployment();