DaanHoogland commented on code in PR #10997:
URL: https://github.com/apache/cloudstack/pull/10997#discussion_r2194879873


##########
server/src/main/java/com/cloud/deploy/FirstFitPlanner.java:
##########
@@ -517,6 +514,104 @@ protected Pair<List<Long>, Map<Long, Double>> 
listPodsByCapacity(long zoneId, in
 
     }
 
+    private Pair<List<Long>, Map<Long, Double>> getOrderedPodsByCapacity(long 
zoneId) {
+        double cpuToMemoryWeight = 
ConfigurationManager.HostCapacityTypeCpuMemoryWeight.value();
+        short capacityType = getHostCapacityTypeToOrderCluster(
+                
configDao.getValue(Config.HostCapacityTypeToOrderClusters.key()), 
cpuToMemoryWeight);
+
+        logger.debug("CapacityType: {} is used for Pod ordering", 
getCapacityTypeName(capacityType));
+        if (capacityType >= 0) { // for capacityType other than COMBINED
+            return capacityDao.orderPodsByAggregateCapacity(zoneId, 
capacityType);
+        }
+        List<CapacityVO> capacities = 
capacityDao.listPodCapacityByCapacityTypes(zoneId, 
List.of(Capacity.CAPACITY_TYPE_CPU, Capacity.CAPACITY_TYPE_MEMORY));
+        Map<Long, Double> podsByCombinedCapacities = 
getPodByCombinedCapacities(capacities, cpuToMemoryWeight);
+        return new Pair<>(new ArrayList<>(podsByCombinedCapacities.keySet()), 
podsByCombinedCapacities);
+    }
+
+    // order pods by combining cpu and memory capacity considering 
cpuToMemoeryWeight

Review Comment:
   should this be javadoc? (it seems the method name already is 
self-documenting)



-- 
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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to