Eli Mesika has uploaded a new change for review.

Change subject: core:There is no notification on event tab about...
......................................................................

core:There is no notification on event tab about...

There is no notification on event tab about what proxy is selected to fence a 
host

Adding a Audit Log notification when a proxy host is selected to do
status,stop,start or restart fencing operations.

Change-Id: Ibfb4fcbb6384e37acfe2159d51c0ce9309e4ec22
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=920112
Signed-off-by: Eli Mesika <emes...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java
M 
backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
4 files changed, 20 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/75/13175/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java
index 8638464..fd3111a 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java
@@ -2,6 +2,7 @@
 
 import java.util.List;
 
+import org.ovirt.engine.core.common.AuditLogType;
 import org.ovirt.engine.core.common.businessentities.FenceActionType;
 import org.ovirt.engine.core.common.businessentities.FenceAgentOrder;
 import org.ovirt.engine.core.common.businessentities.FenceStatusReturnValue;
@@ -19,6 +20,8 @@
 import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.core.dal.dbbroker.DbFacade;
+import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector;
+import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase;
 import org.ovirt.engine.core.utils.linq.LinqUtils;
 import org.ovirt.engine.core.utils.linq.Predicate;
 import org.ovirt.engine.core.utils.log.Log;
@@ -123,15 +126,22 @@
                     _vds.getName());
         }
         else {
-            log.infoFormat("Using Host {0} from {1} as proxy to execute {2} 
command on Host {3}" ,
-                    proxyHost.getName(),
-                    proxyOption.name(),
-                    _action.name(),
-                    _vds.getName());
+            logProxySelection(proxyHost.getName(), proxyOption.name(), 
_action.name());
         }
         return !NO_VDS.equals(proxyHostId);
     }
 
+    private void logProxySelection(String proxy, String origin, String 
command) {
+        AuditLogableBase logable = new AuditLogableBase();
+        logable.addCustomValue("Proxy", proxy);
+        logable.addCustomValue("Origin", origin);
+        logable.addCustomValue("Command", command);
+        logable.setVdsId(_vds.getId());
+        AuditLogDirector.log(logable, AuditLogType.PROXY_HOST_SELECTION);
+        log.infoFormat("Using Host {0} from {1} as proxy to execute {2} 
command on Host {3}",
+                proxy, origin, command, _vds.getName());
+    }
+
     public VDSReturnValue Fence() {
         return Fence(FenceAgentOrder.Primary);
     }
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 9b5b9b3..2f1145e 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
@@ -71,6 +71,9 @@
     // Host time drift Alert
     VDS_TIME_DRIFT_ALERT(604, AuditLogTimeInterval.MINUTE.getValue() * 60),
 
+    // Proxy host selection
+    PROXY_HOST_SELECTION(605),
+
     // -- IRS Log types --
     IRS_FAILURE(22, AuditLogTimeInterval.HOUR.getValue() * 12),
     IRS_DISK_SPACE_LOW(26, AuditLogTimeInterval.HOUR.getValue() * 12),
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java
index 8743616..9f69164 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java
@@ -298,6 +298,7 @@
         severities.put(AuditLogType.VDS_ACTIVATE_FAILED_ASYNC, 
AuditLogSeverity.NORMAL);
         
severities.put(AuditLogType.VDS_SET_NON_OPERATIONAL_VM_NETWORK_IS_BRIDGELESS, 
AuditLogSeverity.NORMAL);
         severities.put(AuditLogType.VDS_TIME_DRIFT_ALERT, 
AuditLogSeverity.WARNING);
+        severities.put(AuditLogType.PROXY_HOST_SELECTION, 
AuditLogSeverity.NORMAL);
     }
 
     @SuppressWarnings("deprecation")
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 26e31f8..6fe4c9c 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -482,6 +482,7 @@
 SYSTEM_VDS_RESTART=Host ${VdsName} was restarted by the engine.
 SYSTEM_FAILED_VDS_RESTART=A restart initiated by the engine to Host ${VdsName} 
has failed.
 VDS_TIME_DRIFT_ALERT=Host ${VdsName} has time-drift of ${Actual} seconds while 
maximum configured value is ${Max} seconds.
+PROXY_HOST_SELECTION=Host ${Proxy} from ${Origin} was choosen as a proxy to 
execute ${Command} command on Host ${VdsName}.
 RECONSTRUCT_MASTER_FAILED_NO_MASTER=No valid Data Storage Domains are 
available in Data Center ${StoragePoolName} (please check your storage 
infrastructure).
 RECONSTRUCT_MASTER_DONE=Reconstruct Master Domain for Data Center 
${StoragePoolName} completed.
 RECONSTRUCT_MASTER_FAILED=Failed to Reconstruct Master Domain for Data Center 
${StoragePoolName}.


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibfb4fcbb6384e37acfe2159d51c0ce9309e4ec22
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