Skip to content

domain dedication - #13654

Open
DaanHoogland wants to merge 7 commits into
apache:mainfrom
DaanHoogland:ghi5803-domain-dedication
Open

domain dedication#13654
DaanHoogland wants to merge 7 commits into
apache:mainfrom
DaanHoogland:ghi5803-domain-dedication

Conversation

@DaanHoogland

Copy link
Copy Markdown
Contributor

Description

This PR...

Fixes: #5803

now using both co-pilot and claude… ;)

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?

Copilot AI and others added 7 commits July 2, 2026 15:04
…r (issue apache#5803)

- Fix findAvoidSetForNonExplicitUserVM to check domain/account dedication before adding pods/clusters/hosts to the avoid list
- Domain-dedicated resources are now accessible to users in the same domain
- Add 4 unit tests covering same-domain, different-domain, same-account, different-account scenarios
- Use mutable ArrayList in test return values to support list.clear() calls in production code
…d tempStorage.clear()

- Use Filter without offset/limit to retrieve all dedicated resources (not just the first)
- Eliminate tempStorage variable and clear() calls to avoid potential side effects
- Code is now cleaner and consistent with correct behavior
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: dahn <daan.hoogland@gmail.com>
findAvoidSetForNonExplicitUserVM referenced _affinityGroupDao, which
has no corresponding mock in DeploymentPlanningManagerImplTest, so it
was always null via Mockito's @Injectmocks and every call NPE'd. Use
_affinityGroupDomainMapDao.listByDomain, already injected and used by
the analogous findAvoiSetForRouterVM method, to detect a domain-level
ExplicitDedication affinity group. Also add a default empty stub for
searchDedicatedPods, mirroring the existing cluster/host stubs, since
the fix now queries pods for both the account and the domain.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 26.66667% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 19.65%. Comparing base (a5b6bc3) to head (70a8698).
⚠️ Report is 422 commits behind head on main.

Files with missing lines Patch % Lines
...om/cloud/deploy/DeploymentPlanningManagerImpl.java 26.66% 21 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #13654      +/-   ##
============================================
+ Coverage     17.89%   19.65%   +1.75%     
- Complexity    16092    19794    +3702     
============================================
  Files          5936     6368     +432     
  Lines        532734   575140   +42406     
  Branches      65165    70379    +5214     
============================================
+ Hits          95347   113029   +17682     
- Misses       426711   449818   +23107     
- Partials      10676    12293    +1617     
Flag Coverage Δ
uitests 3.41% <ø> (-0.27%) ⬇️
unittests 20.92% <26.66%> (+1.92%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

Copilot AI left a comment

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.

Pull request overview

This PR addresses issue #5803 by adjusting deployment planning so that non-explicit User VMs don’t automatically avoid dedicated resources that should be available to them (notably, domain-dedicated pods), and adds unit tests to cover dedicated pod access scenarios.

Changes:

  • Update findAvoidSetForNonExplicitUserVM to remove (from the avoid list candidates) resources dedicated to the VM owner’s account, and conditionally those dedicated to the VM owner’s domain.
  • Relax/adjust the debug message to reflect “not dedicated” rather than “not explicitly dedicated”.
  • Add tests covering domain-dedicated and account-dedicated pod behavior for same-domain/same-account vs different-domain/different-account users.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java Changes avoid-list construction for non-explicit user VMs to allow certain dedicated resources.
server/src/test/java/com/cloud/deploy/DeploymentPlanningManagerImplTest.java Adds test coverage for domain/account-dedicated pod access expectations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +973 to +977
// If the VM owner's domain has an ExplicitDedication domain-level affinity group,
// resources dedicated to that domain are accessible to the VM owner (fixes issue #5803).
List<AffinityGroupDomainMapVO> domainGroupMappings = _affinityGroupDomainMapDao.listByDomain(vmDomainId);
boolean hasDomainExplicitDedicationGroup = domainGroupMappings != null && !domainGroupMappings.isEmpty();

@blueorangutan

Copy link
Copy Markdown

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

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

Test Result Time (s) Test File
test_replace_acl_of_network Error 8.63 test_global_acls.py
ContextSuite context=TestClusterDRS>:setup Error 0.00 test_cluster_drs.py
ContextSuite context=TestConsoleEndpoint>:setup Error 0.00 test_console_endpoint.py
ContextSuite context=TestDeployVirtioSCSIVM>:setup Error 0.00 test_deploy_virtio_scsi_vm.py
test_updating_nics_on_two_shared_networks Error 1.73 test_gateway_on_shared_networks.py
ContextSuite context=TestGatewayOnSharedNetwork>:teardown Error 3.98 test_gateway_on_shared_networks.py
test_01_invalid_upgrade_kubernetes_cluster Failure 9.71 test_kubernetes_clusters.py
test_02_upgrade_kubernetes_cluster Failure 11.67 test_kubernetes_clusters.py
test_03_deploy_and_scale_kubernetes_cluster Failure 8.56 test_kubernetes_clusters.py
test_04_autoscale_kubernetes_cluster Failure 9.62 test_kubernetes_clusters.py
test_05_basic_lifecycle_kubernetes_cluster Failure 8.58 test_kubernetes_clusters.py
test_06_delete_kubernetes_cluster Failure 9.61 test_kubernetes_clusters.py
test_08_upgrade_kubernetes_ha_cluster Failure 11.65 test_kubernetes_clusters.py
test_10_vpc_tier_kubernetes_cluster Error 5.65 test_kubernetes_clusters.py
test_11_test_unmanaged_cluster_lifecycle Error 2.69 test_kubernetes_clusters.py
test_12_test_deploy_cluster_different_offerings_per_node_type Failure 11.70 test_kubernetes_clusters.py
test_01_add_delete_kubernetes_supported_version Error 1802.28 test_kubernetes_supported_versions.py
ContextSuite context=TestMetrics>:setup Error 0.00 test_metrics_api.py
test_01_native_to_native_network_migration Error 17.88 test_migration.py
test_02_native_to_native_vpc_migration Error 12.23 test_migration.py
test_nic_secondaryip_add_remove Error 1518.72 test_multipleips_per_nic.py
ContextSuite context=TestNestedVirtualization>:setup Error 0.00 test_nested_virtualization.py
test_06_vpc_multi_tier_and_restart Error 115.03 test_network_extension_namespace.py
test_07_vpc_network_acl Error 24.41 test_network_extension_namespace.py
test_08_custom_action_policy_based_routing Error 12.78 test_network_extension_namespace.py
test_09_vpc_source_nat_ip_update Error 24.22 test_network_extension_namespace.py
test_10_vpc_custom_action_policy_based_routing Error 18.18 test_network_extension_namespace.py
test_11_ipv6_dualstack_isolated_network Error 13.00 test_network_extension_namespace.py
ContextSuite context=TestNetworkExtensionNamespace>:teardown Error 14.21 test_network_extension_namespace.py
test_03_network_operations_on_created_vm_of_otheruser Failure 126.82 test_network_permissions.py
test_03_network_operations_on_created_vm_of_otheruser Error 126.83 test_network_permissions.py
test_04_deploy_vm_for_other_user_and_test_vm_operations Failure 5.35 test_network_permissions.py
ContextSuite context=TestNetworkPermissions>:teardown Error 3.22 test_network_permissions.py
test_delete_account Error 1517.62 test_network.py
test_delete_network_while_vm_on_it Error 1.22 test_network.py
test_deploy_vm_l2network Error 1.17 test_network.py
test_l2network_restart Error 1.37 test_network.py
ContextSuite context=TestPortForwarding>:setup Error 2.65 test_network.py
ContextSuite context=TestPublicIP>:setup Error 7.26 test_network.py
test_reboot_router Failure 0.10 test_network.py
test_releaseIP Error 3.38 test_network.py
test_releaseIP_using_IP Error 3.44 test_network.py
ContextSuite context=TestRouterRules>:setup Error 3.52 test_network.py
test_01_deployVMInSharedNetwork Failure 2.03 test_network.py
test_02_verifyRouterIpAfterNetworkRestart Failure 4.17 test_network.py
test_03_destroySharedNetwork Failure 1.10 test_network.py
ContextSuite context=TestSharedNetwork>:teardown Error 2.21 test_network.py
ContextSuite context=TestSharedNetworkWithConfigDrive>:setup Error 1520.14 test_network.py
ContextSuite context=TestNonStrictAffinityGroups>:setup Error 0.00 test_nonstrict_affinity_group.py
ContextSuite context=TestIsolatedNetworksPasswdServer>:setup Error 0.00 test_password_server.py
ContextSuite context=TestPrivateGwACL>:setup Error 0.00 test_privategw_acl.py
ContextSuite context=TestProjectSuspendActivate>:setup Error 1529.14 test_projects.py
test_01_purge_expunged_api_vm_start_date Error 3.60 test_purge_expunged_vms.py
test_02_purge_expunged_api_vm_end_date Error 3.15 test_purge_expunged_vms.py
test_03_purge_expunged_api_vm_start_end_date Error 2.59 test_purge_expunged_vms.py
test_04_purge_expunged_api_vm_no_date Error 3.04 test_purge_expunged_vms.py
test_05_purge_expunged_vm_service_offering Error 1.88 test_purge_expunged_vms.py
test_06_purge_expunged_vm_background_task Error 357.22 test_purge_expunged_vms.py
test_deploy_vm_with_registered_userdata Error 6.35 test_register_userdata.py
test_deploy_vm_with_registered_userdata_with_override_policy_allow Error 6.34 test_register_userdata.py
test_deploy_vm_with_registered_userdata_with_override_policy_append Error 6.49 test_register_userdata.py
test_deploy_vm_with_registered_userdata_with_params Error 6.68 test_register_userdata.py
ContextSuite context=TestResetVmOnReboot>:setup Error 0.00 test_reset_vm_on_reboot.py
test_01_so_removal_resource_update Error 0.45 test_resource_accounting.py
ContextSuite context=TestResourceNames>:setup Error 0.00 test_resource_names.py
test_04_extract_template Failure 1.11 test_templates.py
ContextSuite context=TestRestoreVM>:setup Error 0.00 test_restore_vm.py
ContextSuite context=TestRouterDHCPHosts>:setup Error 0.00 test_router_dhcphosts.py
ContextSuite context=TestRouterDHCPOpts>:setup Error 0.00 test_router_dhcphosts.py
test_01_sys_vm_start Failure 180.96 test_secondary_storage.py
test_11_destroy_ssvm Failure 919.89 test_ssvm.py
test_1_userdata_on_ssvm Failure 920.86 test_systemvm_userdata.py

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User from domain can't deploy VM in pod dedicated to that domain

4 participants