Github user koushik-das commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1853#discussion_r106142726
  
    --- Diff: server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java ---
    @@ -584,105 +583,64 @@ private void 
checkForNonDedicatedResources(VirtualMachineProfile vmProfile, Data
                 isExplicit = true;
             }
     
    -        List<Long> allPodsInDc = _podDao.listAllPods(dc.getId());
    -        List<Long> allDedicatedPods = _dedicatedDao.listAllPods();
    -        allPodsInDc.retainAll(allDedicatedPods);
    -
    -        List<Long> allClustersInDc = 
_clusterDao.listAllCusters(dc.getId());
    -        List<Long> allDedicatedClusters = _dedicatedDao.listAllClusters();
    -        allClustersInDc.retainAll(allDedicatedClusters);
    -
    -        List<Long> allHostsInDc = _hostDao.listAllHosts(dc.getId());
    -        List<Long> allDedicatedHosts = _dedicatedDao.listAllHosts();
    -        allHostsInDc.retainAll(allDedicatedHosts);
    -
    -        //Only when the type is instance VM and not explicitly dedicated.
    -        if (vm.getType() == VirtualMachine.Type.User && !isExplicit) {
    -            //add explicitly dedicated resources in avoidList
    -
    -            avoids.addPodList(allPodsInDc);
    -            avoids.addClusterList(allClustersInDc);
    -            avoids.addHostList(allHostsInDc);
    -        }
    -
    -        //Handle the Virtual Router Case
    -        //No need to check the isExplicit. As both the cases are handled.
    -        if (vm.getType() == VirtualMachine.Type.DomainRouter) {
    -            long vmAccountId = vm.getAccountId();
    -            long vmDomainId = vm.getDomainId();
    -
    -            //Lists all explicitly dedicated resources from vm account ID 
or domain ID.
    -            List<Long> allPodsFromDedicatedID = new ArrayList<Long>();
    -            List<Long> allClustersFromDedicatedID = new ArrayList<Long>();
    -            List<Long> allHostsFromDedicatedID = new ArrayList<Long>();
    -
    -            //Whether the dedicated resources belong to Domain or not. If 
not, it may belongs to Account or no dedication.
    -            List<AffinityGroupDomainMapVO> domainGroupMappings = 
_affinityGroupDomainMapDao.listByDomain(vmDomainId);
    -
    -            //For temporary storage and indexing.
    -            List<DedicatedResourceVO> tempStorage;
    -
    -            if (domainGroupMappings == null || 
domainGroupMappings.isEmpty()) {
    -                //The dedicated resource belongs to VM Account ID.
    -
    -                tempStorage = _dedicatedDao.searchDedicatedPods(null, 
vmDomainId, vmAccountId, null).first();
    -
    -                for(DedicatedResourceVO vo : tempStorage) {
    -                    allPodsFromDedicatedID.add(vo.getPodId());
    -                }
    -
    -                tempStorage.clear();
    -                tempStorage = _dedicatedDao.searchDedicatedClusters(null, 
vmDomainId, vmAccountId, null).first();
    +        if ((vm.getType() == VirtualMachine.Type.User && !isExplicit) || 
vm.getType() == VirtualMachine.Type.DomainRouter) {
    --- End diff --
    
    Any reason for this check? checkForNonDedicatedResources() is anyway called 
for user and router VMs.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to