Martin Sivák has uploaded a new change for review.

Change subject: engine: Inform the user when the external scheduler is 
unavailable
......................................................................

engine: Inform the user when the external scheduler is unavailable

If the external scheduler is configured and not responding,
use the Audit log to inform the user about it.

Change-Id: I5a3e56e9a8db16b58305b2ebdc2b8041297da093
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1001986
Signed-off-by: Martin Sivak <msi...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/external/ExternalSchedulerBrokerImpl.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
2 files changed, 16 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/16/21416/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/external/ExternalSchedulerBrokerImpl.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/external/ExternalSchedulerBrokerImpl.java
index 90db4e7..288ce3d 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/external/ExternalSchedulerBrokerImpl.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/external/ExternalSchedulerBrokerImpl.java
@@ -9,10 +9,13 @@
 import org.apache.xmlrpc.XmlRpcException;
 import org.apache.xmlrpc.client.XmlRpcClient;
 import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
+import org.ovirt.engine.core.common.AuditLogType;
 import org.ovirt.engine.core.common.config.Config;
 import org.ovirt.engine.core.common.config.ConfigValues;
 import org.ovirt.engine.core.common.utils.Pair;
 import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector;
+import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase;
 import org.ovirt.engine.core.utils.log.Log;
 import org.ovirt.engine.core.utils.log.LogFactory;
 
@@ -71,6 +74,9 @@
             Map<String, String> propertiesMap) {
 
         try {
+            // Do not call the scheduler when there is no operation requested 
from it
+            if (filterNames.isEmpty()) return hostIDs;
+
             XmlRpcClient client = new XmlRpcClient();
             client.setConfig(config);
             Object result = client.execute(FILTER, 
createFilterArgs(filterNames, hostIDs, vmID, propertiesMap));
@@ -78,6 +84,8 @@
 
         } catch (XmlRpcException e) {
             log.error("Could not communicate with the external scheduler while 
filtering", e);
+            AuditLogableBase loggable = new AuditLogableBase();
+            AuditLogDirector.log(loggable, 
AuditLogType.FAILED_TO_CONNECT_TO_SCHEDULER_PROXY);
             return hostIDs;
         }
     }
@@ -121,6 +129,9 @@
             Guid vmID,
             Map<String, String> propertiesMap) {
         try {
+            // Do not call the scheduler when there is no operation requested 
from it
+            if (scoreNameAndWeight.isEmpty()) return null;
+
             XmlRpcClient client = new XmlRpcClient();
             client.setConfig(config);
             Object result = client.execute(SCORE, 
createScoreArgs(scoreNameAndWeight, hostIDs, vmID, propertiesMap));
@@ -128,6 +139,8 @@
 
         } catch (XmlRpcException e) {
             log.error("Could not communicate with the external scheduler while 
running weight modules", e);
+            AuditLogableBase loggable = new AuditLogableBase();
+            AuditLogDirector.log(loggable, 
AuditLogType.FAILED_TO_CONNECT_TO_SCHEDULER_PROXY);
             return null;
         }
     }
@@ -193,6 +206,8 @@
 
         } catch (XmlRpcException e) {
             log.error("Could not communicate with the external scheduler while 
balancing", e);
+            AuditLogableBase loggable = new AuditLogableBase();
+            AuditLogDirector.log(loggable, 
AuditLogType.FAILED_TO_CONNECT_TO_SCHEDULER_PROXY);
             return null;
         }
     }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
index 1f43262..94ef4a8 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
@@ -800,7 +800,7 @@
     USER_FAILED_TO_REMOVE_CLUSTER_POLICY(9915),
 
     // external scheduler
-    FAILED_TO_CONNECT_TO_SCHEDULER_PROXY(9920),
+    FAILED_TO_CONNECT_TO_SCHEDULER_PROXY(9920, 
AuditLogTimeInterval.MINUTE.getValue()),
 
     //trusted service
     VDS_UNTRUSTED(10000, AuditLogTimeInterval.MINUTE.getValue()),


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a3e56e9a8db16b58305b2ebdc2b8041297da093
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Sivák <msi...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to