Skip to content

Enforce distinct hostnames network #10212

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

Open
wants to merge 3 commits into
base: 4.19
Choose a base branch
from

Conversation

vishesh92
Copy link
Member

@vishesh92 vishesh92 commented Jan 20, 2025

Description

Fixes #9775

This PR adds check to ensure we check for unique hostname for other networks in the VPC as well.

This PR also adds another global setting vm.distinct.hostname.scope which sets the scope of resources for which the VMs should have a unique hostname. Default value is network.

Details

This pull request includes several changes to enhance the network domain search functionality and improve the configuration management for VM hostname uniqueness. The most important changes include adding new methods for network domain searches, updating the search builder initialization, and modifying the hostname uniqueness check logic.

Enhancements to network domain search functionality:

Improvements to VM hostname uniqueness check:

Mock implementation updates:

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?

@vishesh92
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

Copy link

codecov bot commented Jan 20, 2025

Codecov Report

Attention: Patch coverage is 1.25000% with 79 lines in your changes missing coverage. Please review.

Project coverage is 15.85%. Comparing base (9967bb3) to head (91344bf).
Report is 6 commits behind head on 4.19.

Files with missing lines Patch % Lines
.../src/main/java/com/cloud/vm/UserVmManagerImpl.java 0.00% 57 Missing ⚠️
...ain/java/com/cloud/network/dao/NetworkDaoImpl.java 0.00% 22 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.19   #10212      +/-   ##
============================================
+ Coverage     15.13%   15.85%   +0.72%     
- Complexity    11274    11279       +5     
============================================
  Files          5408     5042     -366     
  Lines        473974   444507   -29467     
  Branches      57813    52651    -5162     
============================================
- Hits          71730    70474    -1256     
+ Misses       394227   366156   -28071     
+ Partials       8017     7877     -140     
Flag Coverage Δ
uitests ?
unittests 15.85% <1.25%> (-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.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12125

@vishesh92 vishesh92 force-pushed the enforce-distinct-hostnames-network branch from befd5a5 to 8888b27 Compare January 20, 2025 12:27
@vishesh92
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12130

@vishesh92 vishesh92 marked this pull request as ready for review January 21, 2025 06:26
@DaanHoogland DaanHoogland added this to the 4.19.2 milestone Jan 21, 2025
@vishesh92 vishesh92 force-pushed the enforce-distinct-hostnames-network branch from d7336c1 to c9855aa Compare January 21, 2025 10:39
@vishesh92 vishesh92 force-pushed the enforce-distinct-hostnames-network branch 2 times, most recently from fbd4153 to 5aa2b60 Compare January 21, 2025 10:43
@vishesh92 vishesh92 force-pushed the enforce-distinct-hostnames-network branch from 5aa2b60 to 91344bf Compare January 21, 2025 10:44
@vishesh92
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@apache apache deleted a comment from blueorangutan Jan 21, 2025
@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12144

@vishesh92
Copy link
Member Author

@blueorangutan test

@blueorangutan
Copy link

@vishesh92 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-12146)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 44378 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr10212-t12146-kvm-ol8.zip
Smoke tests completed. 132 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_secure_vm_migration Error 134.42 test_vm_life_cycle.py
test_01_secure_vm_migration Error 134.42 test_vm_life_cycle.py
test_10_attachAndDetach_iso Error 12.63 test_vm_life_cycle.py

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

clgtm

"Scope of resources to check while checking if the hostname is unique. Possible values are global, domain, subdomain, account, network.",
true, ConfigKey.Scope.Global, null, "VM distinct hostname scope", null, null, null, ConfigKey.Kind.Select,
"global,domain,subdomain,account,network");

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please help me understand what's the purpose of this global setting, if VM names have to be unique within a network domain?

Copy link
Member Author

Choose a reason for hiding this comment

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

So, the network domain can be same for networks in different domain, account, etc. If a user a launches a VM with the same name in these networks, there can be conflict. This global setting allows the user to set scope for what all networks we need to check when creating a vm.

@DaanHoogland DaanHoogland modified the milestones: 4.19.2, 4.19.3 Feb 11, 2025
@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12671

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-12597)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 44730 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr10212-t12597-kvm-ol8.zip
Smoke tests completed. 133 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Option to restrict duplicate instance names in same network domain, VPC etc
5 participants