Skip to content

[Draft] server: do not allocate nic on public network for NSX VPC VR #10081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: 4.20
Choose a base branch
from

Conversation

weizhouapache
Copy link
Member

Description

The VPC VR for NSX has a public interface/IP allocated, which is not needed as the VPC VR only provides Dhcp/Dns/UserData services.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

Copy link

codecov bot commented Dec 11, 2024

Codecov Report

Attention: Patch coverage is 12.50000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 16.03%. Comparing base (e57a82a) to head (02f193c).

Files with missing lines Patch % Lines
...ain/java/com/cloud/network/vpc/VpcManagerImpl.java 0.00% 7 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #10081      +/-   ##
============================================
- Coverage     16.03%   16.03%   -0.01%     
  Complexity    12814    12814              
============================================
  Files          5637     5637              
  Lines        493506   493513       +7     
  Branches      59831    59835       +4     
============================================
+ Hits          79129    79130       +1     
- Misses       405601   405607       +6     
  Partials       8776     8776              
Flag Coverage Δ
uitests 4.02% <ø> (ø)
unittests 16.87% <12.50%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +3405 to +3412
@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));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about StaticNat (and maybe others)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good question
To be honest, I never tested the case that SourceNat and StaticNat are provided by different providers (e.g. Nsx for Source NAT and VPCVirtualRouter for Static NAT). I do not think it will work.

this PR is aligned with the 4.19 code

@Override
public boolean isSrcNatIpRequired(long vpcOfferingId) {
final Map<Network.Service, Set<Network.Provider>> vpcOffSvcProvidersMap = getVpcOffSvcProvidersMap(vpcOfferingId);
return vpcOffSvcProvidersMap.get(Network.Service.SourceNat).contains(Network.Provider.VPCVirtualRouter);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, might work. As you create a method isSrcNatIpRequiredForVpcVr the contents seems appropriate, but its use is more like needsPublicInterface does it? and in that case we would also want to test if the VR needs to provide StaticNat. I think a Gateway could be on a static ip as well, in theory at least.

maybe rename the method?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for isolated networks (NATTED mode by default), it uses VR as SourceNat
for Routed networks, it uses VR as Gateway
in both cases, the VR needs a public IP (as Source NAT or Gateway)

For Static NAT, I think we do not need to add a public interface to the VR when VR is created.
when Static NAT is enabled, it may add a public interface if needed

@weizhouapache
Copy link
Member Author

@weizhouapache weizhouapache changed the title server: do not allocate nic on public network for NSX VPC VR [Draft] server: do not allocate nic on public network for NSX VPC VR Dec 13, 2024
@weizhouapache
Copy link
Member Author

as discussed offline, we need to evaluate the impact of the changes and test heavily.
moved to draft, we will revisit in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants