Gilad Chaplik has uploaded a new change for review.

Change subject: core: more accurate scores for ED weight module
......................................................................

core: more accurate scores for ED weight module

Even Distribution (ED) weight module inner calculation score
is a real number, and we expose it as an integer by rounding it
up.
Currently we round it up (Math.ceil), but to be more accurate we should round
it to nearest integer (Math.round).
To avoid 0 adding 1 to the score.

Change-Id: Ib668cf266629eb4e0f2c1cbd5ac893dc7deac19c
Bug-Url: https://bugzilla.redhat.com/1040460
Signed-off-by: Gilad Chaplik <gchap...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/EvenDistributionWeightPolicyUnit.java
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/15/22415/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/EvenDistributionWeightPolicyUnit.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/EvenDistributionWeightPolicyUnit.java
index a549a3d..431d822 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/EvenDistributionWeightPolicyUnit.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/EvenDistributionWeightPolicyUnit.java
@@ -46,8 +46,9 @@
         if (effectiveCpuCores != null
                 && vds.getUsageCpuPercent() != null
                 && vds.getPendingVcpusCount() != null) {
-            // round up result, fractions matters
-            score = Math.min((int) Math.ceil(calcDistributeMetric(vds, vm, 
effectiveCpuCores)), MaxSchedulerWeight);
+            // round the result and adding one to avoid zero
+            score = Math.min((int) Math.round(
+                    calcDistributeMetric(vds, vm, effectiveCpuCores)) + 1, 
MaxSchedulerWeight);
         }
         return score;
     }


-- 
To view, visit http://gerrit.ovirt.org/22415
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib668cf266629eb4e0f2c1cbd5ac893dc7deac19c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Gilad Chaplik <gchap...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to