Spaceman1984 commented on a change in pull request #4428:
URL: https://github.com/apache/cloudstack/pull/4428#discussion_r524005759



##########
File path: 
engine/storage/src/main/java/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java
##########
@@ -115,22 +123,46 @@ protected EndPoint findEndPointInScope(Scope scope, 
String sqlBase, Long poolId)
         StringBuilder sbuilder = new StringBuilder();
         sbuilder.append(sqlBase);
 
+        List<Long> dedicatedHosts = new ArrayList<Long>();
+
         if (scope != null) {
             if (scope.getScopeType() == ScopeType.HOST) {
                 sbuilder.append(" and h.id = ");
                 sbuilder.append(scope.getScopeId());
             } else if (scope.getScopeType() == ScopeType.CLUSTER) {
                 sbuilder.append(" and h.cluster_id = ");
                 sbuilder.append(scope.getScopeId());
+                DedicatedResourceVO dedicatedHost = 
dedicatedResourceDao.findByClusterId(scope.getScopeId());
+                if (dedicatedHost != null){
+                    List<HostVO> clusterHosts = 
hostDao.findByClusterId(scope.getScopeId());
+                    for (HostVO hostVO: clusterHosts){
+                        dedicatedHosts.add(hostVO.getId());
+                    }
+                }
             } else if (scope.getScopeType() == ScopeType.ZONE) {
                 sbuilder.append(" and h.data_center_id = ");
                 sbuilder.append(scope.getScopeId());
+                DedicatedResourceVO dedicatedHost = 
dedicatedResourceDao.findByZoneId(scope.getScopeId());
+                if (dedicatedHost != null){
+                    List<HostVO> zoneHosts = 
hostDao.findByDataCenterId(scope.getScopeId());
+                    for (HostVO hostVO: zoneHosts){
+                        dedicatedHosts.add(hostVO.getId());
+                    }
+                }
             }
         }
+        // We didn't find any hosts specifically dedicated to a zone or cluster
+        if (dedicatedHosts.size() == 0) {
+            dedicatedHosts = dedicatedResourceDao.listAllHosts();

Review comment:
       This is not possible




----------------------------------------------------------------
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.

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


Reply via email to