Martin Sivák has posted comments on this change. Change subject: sla: Update balancers and add memory based load balancing ......................................................................
Patch Set 4: (3 comments) https://gerrit.ovirt.org/#/c/38189/4/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/CpuAndMemoryBalancingPolicyUnit.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/CpuAndMemoryBalancingPolicyUnit.java: Line 109: // if no host has memory to spare, then there is nothing we can do to balance it.. Line 110: if (underUtilizedHosts == null || underUtilizedHosts.size() == 0) { Line 111: log.warn("All hosts are Memory over-utilized, can't Memory balance the cluster '{}'", cluster.getName()); Line 112: return null; Line 113: } > am not big fan of Pair but it can be handy sometime. any other thought on m Not really.. this returns a VM to migrate and a list of candidate host. We would have to test for special value anyway since the VM to migrate is not iterable. Line 114: Line 115: FindVmAndDestinations.Result result = findVmAndDestinations.invoke(overUtilizedMemoryHosts, underUtilizedHosts, getVmDao()); Line 116: if (result != null) { Line 117: destinationHosts = result.getDestinationHosts(); Line 149: List<VDS> result = new ArrayList<>(); Line 150: Line 151: for (VDS h: hosts) { Line 152: if (h.getMaxSchedulingMemory() > lowFreeMemoryLimit Line 153: && h.getVmCount() >= minVmCount) { > this is very obscure. the method name says you get a list of hosts which ar Well it will be in the list if you pass 0 there. It uses 0 for evenly distributed (because it looks for destination host) and 1 for the power saving, because it looks for a source host. I updated the docstring. Line 154: result.add(h); Line 155: } Line 156: } Line 157: https://gerrit.ovirt.org/#/c/38189/4/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/utils/VdsCpuUsageComparator.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/utils/VdsCpuUsageComparator.java: Line 13: INSTANCE; Line 14: Line 15: @Override Line 16: public int compare(VDS o1, VDS o2) { Line 17: return Integer.valueOf(calculateCpuUsage(o1)).compareTo(calculateCpuUsage(o2)); > just mean that you can use Integer.compare(x,y) directly Done Line 18: } Line 19: Line 20: private static int calculateCpuUsage(VDS o1) { Line 21: return o1.getUsageCpuPercent() * SlaValidator.getEffectiveCpuCores(o1) / o1.getVdsStrength(); -- To view, visit https://gerrit.ovirt.org/38189 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1fe13267feca89ab6c8fb9d85656f05930d0b333 Gerrit-PatchSet: 4 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Sivák <msi...@redhat.com> Gerrit-Reviewer: Martin Sivák <msi...@redhat.com> Gerrit-Reviewer: Roy Golan <rgo...@redhat.com> Gerrit-Reviewer: Tomer Saban <tsa...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches