Skip to content

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

Draft
weizhouapache wants to merge 1 commit into
apache:4.20from
weizhouapache:4.20-do-not-allocate-public-nic-nsx-vr
Draft

[Draft] server: do not allocate nic on public network for NSX VPC VR#10081
weizhouapache wants to merge 1 commit into
apache:4.20from
weizhouapache:4.20-do-not-allocate-public-nic-nsx-vr

Conversation

@weizhouapache

Copy link
Copy Markdown
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?

@codecov

codecovBot commented Dec 11, 2024

Copy link
Copy Markdown

Codecov Report

❌ 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).
⚠️ Report is 541 commits behind head on 4.20.

Files with missing linesPatch %Lines
...ain/java/com/cloud/network/vpc/VpcManagerImpl.java0.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 
FlagCoverage Δ
uitests4.02% <ø> (ø)
unittests16.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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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
Copy Markdown
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
Copy Markdown
MemberAuthor

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
publicbooleanisSrcNatIpRequired(longvpcOfferingId) {
finalMap<Network.Service, Set<Network.Provider>> vpcOffSvcProvidersMap = getVpcOffSvcProvidersMap(vpcOfferingId);
returnvpcOffSvcProvidersMap.get(Network.Service.SourceNat).contains(Network.Provider.VPCVirtualRouter);
}

Copy link
Copy Markdown
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
Copy Markdown
MemberAuthor

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
Copy Markdown
MemberAuthor

@weizhouapacheweizhouapache 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 VRDec 13, 2024
@weizhouapache

Copy link
Copy Markdown
MemberAuthor

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 freeto 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.

4 participants

@weizhouapache@DaanHoogland@sureshanaparti@abh1sar