Arik Hadas has uploaded a new change for review.

Change subject: core: replace b7319df0
......................................................................

core: replace b7319df0

b7319df0447ea5aed80752fdb924482298e3d1f0 introduced a solution for
filtering duplicated events for successful hibernate operation.

This patch replace it with a simpler implementation.

Change-Id: I3f39bff153baef256def7cb405e51336fb571be7
Signed-off-by: Arik Hadas <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java
1 file changed, 4 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/21/37021/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java
index 5173b68..090ed24 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java
@@ -193,19 +193,16 @@
         return AsyncTaskType.createVolume;
     }
 
-    /**
-     * Note: the treatment for {@link CommandActionState#END_SUCCESS} is the 
same as for {@link CommandActionState#END_FAILURE}
-     * because if after calling {@link HibernateVmCommand#endSuccessfully()} 
the method {@link HibernateVmCommand#getSucceeded()}
-     * returns true, the command is set not to be logged and this method is 
not called
-     *
-     * @see {@link HibernateVmCommand#endSuccessfully()}
-     */
     @Override
     public AuditLogType getAuditLogTypeValue() {
         switch (getActionState()) {
         case EXECUTE:
             return getSucceeded() ? AuditLogType.USER_SUSPEND_VM : 
AuditLogType.USER_FAILED_SUSPEND_VM;
         case END_SUCCESS:
+            if (getSucceeded()) {
+                // no event should be displayed if the command ended 
successfully, the monitoring will log it
+                return AuditLogType.UNASSIGNED;
+            }
         case END_FAILURE:
         default:
             return isHibernateVdsProblematic ? 
AuditLogType.USER_SUSPEND_VM_FINISH_FAILURE_WILL_TRY_AGAIN
@@ -273,12 +270,6 @@
 
     @Override
     protected void endSuccessfully() {
-        endSuccessfullyImpl();
-        // no event should be displayed if the command ended successfully
-        setCommandShouldBeLogged(!getSucceeded());
-    }
-
-    private void endSuccessfullyImpl() {
         if (getVm() != null) {
             if (getVm().getStatus() != VMStatus.PreparingForHibernate) {
                 // If the Vm is not PreparingForHibernate, we shouldn't 
perform Hibernate on it,


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

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

Reply via email to