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, 22 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/16/21516/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 f7433a4..3f6fbb6 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,11 @@
             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,8 +86,14 @@
 
         } catch (XmlRpcException e) {
             log.error("Could not communicate with the external scheduler while 
filtering", e);
+            auditLogFailedToConnect();
             return hostIDs;
         }
+    }
+
+    private void auditLogFailedToConnect() {
+        AuditLogableBase loggable = new AuditLogableBase();
+        AuditLogDirector.log(loggable, 
AuditLogType.FAILED_TO_CONNECT_TO_SCHEDULER_PROXY);
     }
 
     private Object[] createFilterArgs(List<String> filterNames,
@@ -121,6 +135,11 @@
             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 +147,7 @@
 
         } catch (XmlRpcException e) {
             log.error("Could not communicate with the external scheduler while 
running weight modules", e);
+            auditLogFailedToConnect();
             return null;
         }
     }
@@ -193,6 +213,7 @@
 
         } catch (XmlRpcException e) {
             log.error("Could not communicate with the external scheduler while 
balancing", e);
+            auditLogFailedToConnect();
             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 d1765e1..66da936 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
@@ -801,7 +801,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/21516
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a3e56e9a8db16b58305b2ebdc2b8041297da093
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
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