DaanHoogland commented on code in PR #8521:
URL: https://github.com/apache/cloudstack/pull/8521#discussion_r1457116173
##########
api/src/main/java/org/apache/cloudstack/cluster/ClusterDrsAlgorithm.java:
##########
@@ -164,4 +213,31 @@ default Double getClusterStandardDeviation(List<Double>
metricList, Double mean)
return new
StandardDeviation(false).evaluate(metricList.stream().mapToDouble(i ->
i).toArray());
}
}
+
+ default List<Double> getMetricList(Long clusterId, List<Ternary<Long,
Long, Long>> hostMetricsList, Float skipThreshold) {
+ boolean useRatio = ClusterDrsMetricUseRatio.valueIn(clusterId);
+ List<Double> list = new ArrayList<>();
+ for (Ternary<Long, Long, Long> ternary : hostMetricsList) {
+ long used = ternary.first();
+ long actualTotal = ternary.third() - ternary.second();
+ long free = actualTotal - ternary.first();
+ switch (ClusterDrsMetricType.valueIn(clusterId)) {
+ case "free":
+ if (skipThreshold != null && free < skipThreshold *
actualTotal) continue;
+ if (useRatio) {
+ list.add((double) free / actualTotal);
+ } else {
+ list.add((double) free);
+ }
+ case "used":
+ if (skipThreshold != null && used > skipThreshold *
actualTotal) continue;
+ if (useRatio) {
+ list.add((double) used / actualTotal);
+ } else {
+ list.add((double) used);
+ }
+ }
+ }
Review Comment:
`addHostValueToImbalanceList()` but with skip flag
--
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]