Eli Mesika has uploaded a new change for review.

Change subject: core: fix non-responding logging in case of no PM
......................................................................

core: fix non-responding logging in case of no PM

This patch fixes the messages written to application log and to the
audit log in the case that the host is non-responsive but does not have
any configured power management.

Change-Id: I1f7e7a9987be93023309c0b25f35d856d2ec1f04
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1175290
Signed-off-by: emesika <emes...@redhat.com>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
M 
backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
3 files changed, 19 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/97/36397/1

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 0382735..c86d113 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
@@ -926,7 +926,7 @@
     FENCE_OPERATION_FAILED(9019, AuditLogSeverity.ERROR),
     FENCE_USING_AGENT_AND_PROXY_HOST(9020),
     FENCE_OPERATION_FAILED_USING_PROXY(9021, AuditLogSeverity.WARNING),
-
+    VDS_HOST_NOT_RESPONDING(9022, AuditLogSeverity.WARNING, 
AuditLogTimeInterval.MINUTE.getValue() * 3),
 
     TASK_STOPPING_ASYNC_TASK(9500, AuditLogTimeInterval.MINUTE.getValue()),
     TASK_CLEARING_ASYNC_TASK(9501, AuditLogTimeInterval.MINUTE.getValue()),
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
index a4896a8..3a448a6 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -637,6 +637,7 @@
 VDS_ALERT_NOT_RESTARTED_DUE_TO_POLICY=Host ${VdsName} became non responsive 
and was not restarted due to the Cluster Fencing Policy.
 VDS_ALERT_FENCE_DISABLED_BY_CLUSTER_POLICY=Host ${VdsName} became Non 
Responsive and was not restarted due to disabled fencing in the Cluster Fencing 
Policy.
 VDS_HOST_NOT_RESPONDING_CONNECTING=Host ${VdsName} is not responding. It will 
stay in Connecting state for a grace period of ${Seconds} seconds and after 
that an attempt to fence the host will be issued.
+VDS_HOST_NOT_RESPONDING=Host ${VdsName} is not responding.
 TASK_STOPPING_ASYNC_TASK=Stopping async task ${CommandName} that started at 
${Date}
 REFRESH_REPOSITORY_IMAGE_LIST_FAILED=Refresh image list failed for domain(s): 
${imageDomains}. Please check domain activity.
 REFRESH_REPOSITORY_IMAGE_LIST_SUCCEEDED=Refresh image list succeeded for 
domain(s): ${imageDomains}
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
index 3dc4a41..1a16463 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
@@ -695,7 +695,7 @@
         boolean saveToDb = true;
         if (cachedVds.getStatus() != VDSStatus.Down) {
             long timeoutToFence = calcTimeoutToFence(cachedVds.getVmCount(), 
cachedVds.getSpmStatus());
-            logHostNonResponding(timeoutToFence);
+            logHostNonResponding(timeoutToFence, cachedVds);
             if (inGracePeriod(timeoutToFence)) {
                 if (cachedVds.getStatus() != VDSStatus.Connecting
                         && cachedVds.getStatus() != 
VDSStatus.PreparingForMaintenance
@@ -747,15 +747,25 @@
         AuditLogDirector.log(logable, AuditLogType.VDS_FAILURE);
     }
 
-    private void logHostNonResponding(long timeoutToFence) {
-        log.warn("Host '{}' is not responding. It will stay in Connecting 
state for a grace period " +
-                        "of {} seconds and after that an attempt to fence the 
host will be issued.",
-                cachedVds.getName(),
-                TimeUnit.MILLISECONDS.toSeconds(timeoutToFence));
+    private void logHostNonResponding(long timeoutToFence, VDS host) {
+        String msg;
+        AuditLogType auditLogType;
+
+        if ( host.getpm_enabled()) {
+            msg = "Host '{}' is not responding. It will stay in Connecting 
state for a grace period " +
+                    "of {} seconds and after that an attempt to fence the host 
will be issued.";
+            auditLogType = AuditLogType.VDS_HOST_NOT_RESPONDING_CONNECTING;
+            log.warn(msg, cachedVds.getName(), 
TimeUnit.MILLISECONDS.toSeconds(timeoutToFence));
+        }
+        else {
+            msg = "Host '{}' is not responding.";
+            auditLogType = AuditLogType.VDS_HOST_NOT_RESPONDING;
+            log.warn(msg, cachedVds.getName());
+        }
         AuditLogableBase logable = new AuditLogableBase();
         logable.setVdsId(cachedVds.getId());
         logable.addCustomValue("Seconds", 
Long.toString(TimeUnit.MILLISECONDS.toSeconds(timeoutToFence)));
-        AuditLogDirector.log(logable, 
AuditLogType.VDS_HOST_NOT_RESPONDING_CONNECTING);
+        AuditLogDirector.log(logable, auditLogType);
     }
 
     public void dispose() {


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f7e7a9987be93023309c0b25f35d856d2ec1f04
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Eli Mesika <emes...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to