-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Enforce distinct hostnames network #10212
Conversation
@blueorangutan package |
@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. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10212 +/- ##
============================================
- Coverage 17.54% 17.54% -0.01%
+ Complexity 15483 15482 -1
============================================
Files 5897 5897
Lines 527484 527554 +70
Branches 64432 64441 +9
============================================
Hits 92566 92566
- Misses 424508 424578 +70
Partials 10410 10410
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12125 |
befd5a5
to
8888b27
Compare
@blueorangutan package |
@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. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12130 |
d7336c1
to
c9855aa
Compare
5aa2b60
to
91344bf
Compare
@blueorangutan package |
@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. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12144 |
@blueorangutan test |
@vishesh92 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
[SF] Trillian test result (tid-12146)
|
There was a problem hiding this 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"); | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vishesh92 can you please add "project" and "vpc" to the scope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For project, we specify account_id as the project id. So, this is covered by the account scope. Adding project will make the check complicated.
For networks in a VPC, the network domain is same for all.
94c9fc8
to
6f2136e
Compare
@blueorangutan package |
@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. |
Packaging result [SF]: ✖️ el8 ✖️ el9 ✔️ debian ✖️ suse15. SL-JID 15252 |
@blueorangutan package |
@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. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15273 |
@blueorangutan test |
@vishesh92 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
[SF] Trillian test result (tid-14515)
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
@blueorangutan package |
@nvazquez 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. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15364 |
@blueorangutan test |
@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - manually tested these cases:
-
Default value:
vm.distinct.hostname.scope = network
:- Created a project and VPC1 and VPC2 under the project with one tier each
- Created VM with name 'vm1' on VPC1 tier 1
- Created VM with name 'vm1' on VPC2 tier 1 -> OK (previous behavior preserved)
-
Set
vm.distinct.hostname.scope = global
:- Created VPC2 tier 2
- Tried creating VM with name 'vm1' -> Fails with error:
The vm with hostName vm1 already exists in the network domain: cs130cloud.internal; network=Vpc1-Tier1
-
Set
vm.distinct.hostname.scope = domain
:- Created subdomain D1 and a domain admin on the new domain, log in as the domain admin:
- Created Isolated network D1N1 on D1
- Created VM on D1N1 with name 'vm1'
- Created Isolated network D1N2 on D1
- Tried creating VM with name 'vm1' on D1N2 -> Fails with error:
The vm with hostName vm1 already exists in the network domain: cs131cloud.internal; network=Isolated-Dom1
-
Set
vm.distinct.hostname.scope = account
:- Login as the ROOT admin
- Create Isolated network
- Create VM with name 'vm1' on the network
- Create Isolated network 2
- Try to create VM with name 'vm1' on Isolated Network 2 -> Fails with error:
The vm with hostName vm1 already exists in the network domain: cs2cloud.internal; network=Isolated1-Admin
- Set
vm.distinct.hostname.scope = network
- Create VM with name 'vm1' on Isolated Network 2 -> OK
@harikrishna-patnala @Pearl1594 are you ok to merge this? |
[SF] Trillian test result (tid-14603)
|
* Check for unique hostnames for all networks in the vpc * Address comments
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 isnetwork
.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:
engine/schema/src/main/java/com/cloud/network/dao/NetworkDao.java
: Added new methodslistByNetworkDomains
,listByNetworkDomainsAndAccountIds
, andlistByNetworkDomainsAndDomainIds
to theNetworkDao
interface.engine/schema/src/main/java/com/cloud/network/dao/NetworkDaoImpl.java
: AddedNetworkDomainSearch
to theNetworkDaoImpl
class and initialized it in theinit
method. Implemented the new methods for network domain searches. [1] [2] [3]Improvements to VM hostname uniqueness check:
server/src/main/java/com/cloud/vm/UserVmManager.java
: Introduced a new configuration keyVmDistinctHostNameScope
to manage the scope of hostname uniqueness checks.server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
: Updated the logic for checking hostname uniqueness to use the new network domain search methods and theVmDistinctHostNameScope
configuration. [1] [2]Mock implementation updates:
server/src/test/java/com/cloud/vpc/dao/MockNetworkDaoImpl.java
: Added mock implementations for the new network domain search methods.Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?