Arik Hadas has uploaded a new change for review. Change subject: core: remove duplicate event on successful hibernation ......................................................................
core: remove duplicate event on successful hibernation Successful hibernating (suspending) VM resulted in three events: 1. event that indicates that the action was initiated 2. event that indicates that the action was completed 3. event that indicates that the VM is suspended The second event was generated by the command and the third event was generated by the monitoring. those two messages are expressing the same thing so we don't need both of them. Moreover, the second event is misleading because the command generates it right after sending the request to VDSM, thus it can't say that the action is completed at that point. so this patch removes the second event. Change-Id: I5445374ddf6996e696c71995fe3bd2a9ddd60a85 Bug-Url: https://bugzilla.redhat.com/918306 Signed-off-by: Arik Hadas <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java 2 files changed, 15 insertions(+), 7 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/38/12838/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 47ad678..3a66f90 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 @@ -195,6 +195,13 @@ return (HibernateVmParameters) ((tempVar instanceof HibernateVmParameters) ? tempVar : null); } + /** + * 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()) { @@ -202,12 +209,6 @@ return getHibernateVmParams().getAutomaticSuspend() ? getSucceeded() ? AuditLogType.AUTO_SUSPEND_VM : AuditLogType.AUTO_FAILED_SUSPEND_VM : getSucceeded() ? AuditLogType.USER_SUSPEND_VM : AuditLogType.USER_FAILED_SUSPEND_VM; - - case END_SUCCESS: - return getHibernateVmParams().getAutomaticSuspend() ? getSucceeded() ? AuditLogType.AUTO_SUSPEND_VM_FINISH_SUCCESS - : AuditLogType.AUTO_SUSPEND_VM_FINISH_FAILURE - : getSucceeded() ? AuditLogType.USER_SUSPEND_VM_FINISH_SUCCESS - : isHibernateVdsProblematic ? AuditLogType.USER_SUSPEND_VM_FINISH_FAILURE_WILL_TRY_AGAIN : AuditLogType.USER_SUSPEND_VM_FINISH_FAILURE; default: return getHibernateVmParams().getAutomaticSuspend() ? AuditLogType.AUTO_SUSPEND_VM_FINISH_FAILURE @@ -296,6 +297,12 @@ @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.SavingState && getVm().getStatus() != VMStatus.Up) { // If the Vm is not in SavingState/Up status, we shouldn't @@ -345,7 +352,6 @@ } else { - setCommandShouldBeLogged(false); log.warn("HibernateVmCommand::EndSuccessfully: Vm is null - not performing full EndAction."); setSucceeded(true); } 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 391b03c..b5a2693 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 @@ -116,6 +116,7 @@ USER_PAUSE_VM(39), USER_FAILED_PAUSE_VM(55), USER_SUSPEND_VM(501), + @Deprecated USER_SUSPEND_VM_FINISH_SUCCESS(512), USER_SUSPEND_VM_FINISH_FAILURE(521), USER_SUSPEND_VM_FINISH_FAILURE_WILL_TRY_AGAIN(532), @@ -293,6 +294,7 @@ USER_FAILED_CLEAR_UNKNOWN_VMS(349), AUTO_SUSPEND_VM(524), + @Deprecated AUTO_SUSPEND_VM_FINISH_SUCCESS(525), AUTO_SUSPEND_VM_FINISH_FAILURE(526), AUTO_FAILED_SUSPEND_VM(527), -- To view, visit http://gerrit.ovirt.org/12838 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5445374ddf6996e696c71995fe3bd2a9ddd60a85 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
