Copilot commented on code in PR #13654:
URL: https://github.com/apache/cloudstack/pull/13654#discussion_r4751815374


##########
server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java:
##########
@@ -1083,13 +1086,61 @@ private void findAvoiSetForRouterVM(ExcludeList avoids, 
VirtualMachine vm, List<
     }
 
     private void findAvoidSetForNonExplicitUserVM(ExcludeList avoids, 
VirtualMachine vm, List<Long> allPodsInDc, List<Long> allClustersInDc, 
List<Long> allHostsInDc) {
+        if (allPodsInDc.isEmpty() && allClustersInDc.isEmpty() && 
allHostsInDc.isEmpty()) {
+            // Nothing in this DC is dedicated to anyone, so there is nothing 
to avoid or to check dedication for.
+            return;
+        }
+
+        long vmAccountId = vm.getAccountId();
+        long vmDomainId = vm.getDomainId();
+
+        // If the VM owner's domain has an ExplicitDedication domain-level 
affinity group,
+        // resources dedicated to that domain are accessible to the VM owner 
as well.
+        boolean hasDomainExplicitDedicationGroup =
+                _affinityGroupDao.findDomainLevelGroupByType(vmDomainId, 
EXPLICIT_DEDICATION_AFFINITY_GROUP_TYPE) != null;

Review Comment:
   For a VM in child domain D/child, a pod dedicated to D remains in the avoid 
list because this lookup and the resource searches only use the VM's exact 
domain; deployment fails if that pod is the only available capacity. This 
conflicts with inherited access supported by 
`ExplicitDedicationProcessor.subDomainAccess()` and 
`AffinityGroupServiceImpl.isAffinityGroupAvailableInDomain()`. Include 
accessible ancestor-domain dedications for pods, clusters, and hosts while 
preserving account-specific exclusions, and add a child-domain regression test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to