Hello Laszlo Hornyak,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/18558

to review the following change.

Change subject: engine: handle unavailable external scheduler
......................................................................

engine: handle unavailable external scheduler

handle the case when the external scheduler is not available when
calculating scores for the hosts

Change-Id: Ib5e60b4be166da95c1d46449b222e14220963784
Signed-off-by: Laszlo Hornyak <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java
1 file changed, 12 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/58/18558/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java
index 87cb89d..c04817a 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java
@@ -500,13 +500,19 @@
     }
 
     private void sumScoreResults(Map<Guid, Integer> hostCostTable, 
List<Pair<Guid, Integer>> externalScores) {
-        for (Pair<Guid, Integer> pair : externalScores) {
-            Guid hostId = pair.getFirst();
-            if (hostCostTable.get(hostId) == null) {
-                hostCostTable.put(hostId, 0);
+        if (externalScores == null) {
+            // the external scheduler proxy may return null if error happens, 
in this case the external scores will
+            // remain empty
+            log.warn("External scheduler proxy returned null score");
+        } else {
+            for (Pair<Guid, Integer> pair : externalScores) {
+                Guid hostId = pair.getFirst();
+                if (hostCostTable.get(hostId) == null) {
+                    hostCostTable.put(hostId, 0);
+                }
+                hostCostTable.put(hostId,
+                        hostCostTable.get(hostId) + pair.getSecond());
             }
-            hostCostTable.put(hostId,
-                    hostCostTable.get(hostId) + pair.getSecond());
         }
     }
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib5e60b4be166da95c1d46449b222e14220963784
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Gilad Chaplik <[email protected]>
Gerrit-Reviewer: Laszlo Hornyak <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to