Yair Zaslavsky has uploaded a new change for review.

Change subject: core: use 'Engine' for username if fencing operation is done 
internally
......................................................................

core: use 'Engine' for username if fencing operation is done internally

If fencing is initiated internally (i.e - VdsManager -> NonResponsiveTreatment)
Events will contain message with a string of <Unknown> instead we should
indicate the operation (i.e - host was started) was carried out by the engine.
Comment for reviewer - maybe we should consider replacing this string at
AuditLogDirector
for all events if the message contains the variable of UserName

Bug-Url: https://bugzilla.redhat.com/862797
Change-Id: Ide867f16d092eb329c0ce2fccf4ebd02f3aae3ce
Signed-off-by: Yair Zaslavsky <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/76/9376/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
index 963cf3e..b7b5f36 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
@@ -2,6 +2,7 @@
 
 import java.util.List;
 
+import org.apache.commons.lang.StringUtils;
 import org.ovirt.engine.core.bll.job.ExecutionHandler;
 import org.ovirt.engine.core.common.AuditLogType;
 import org.ovirt.engine.core.common.action.FenceVdsActionParameters;
@@ -33,6 +34,7 @@
 
 public abstract class FenceVdsBaseCommand<T extends FenceVdsActionParameters> 
extends VdsCommand<T> {
     private final int SLEEP_BEFORE_FIRST_ATTEMPT = 5000;
+    private static final String INTERNAL_FENCING_USER = "Engine";
     private static Log log = LogFactory.getLog(FenceVdsBaseCommand.class);
     protected FencingExecutor _executor;
     protected List<VM> mVmList = null;
@@ -257,6 +259,14 @@
 
     protected void HandleError() {
     }
+    
+    @Override
+    public String getUserName() {
+        String userName = super.getUserName();
+        return StringUtils.isEmpty(userName)? INTERNAL_FENCING_USER: userName;
+    }
+    
+    
 
     protected boolean waitForStatus(String vdsName, FenceActionType 
actionType) {
         final String FENCE_CMD = (actionType == FenceActionType.Start) ? "on" 
: "off";


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide867f16d092eb329c0ce2fccf4ebd02f3aae3ce
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yair Zaslavsky <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to