Liron Aravot has uploaded a new change for review. Change subject: core: ForceSelectSPM might fail ......................................................................
core: ForceSelectSPM might fail ForceSelectSPM is performing nothing in case that the current SPM can't be stopped but its execution is always marked as succesful. In case of failure an appropiate audit log should be displayed. Change-Id: Ia1a32ec7b68c3643e28751d61ba070b4e4cc09ea Bug-Url: https://bugzilla.redhat.com/1119852 Signed-off-by: Liron Aravot <lara...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ForceSelectSPMCommand.java 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 3 files changed, 10 insertions(+), 12 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/26/31926/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ForceSelectSPMCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ForceSelectSPMCommand.java index abd402e..f3c594f 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ForceSelectSPMCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ForceSelectSPMCommand.java @@ -16,6 +16,7 @@ import org.ovirt.engine.core.common.errors.VdcBllMessages; import org.ovirt.engine.core.common.vdscommands.VDSCommandType; import org.ovirt.engine.core.compat.Guid; +import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector; import org.ovirt.engine.core.vdsbroker.irsbroker.SpmStopOnIrsVDSCommandParameters; @NonTransactiveCommandAttribute @@ -66,7 +67,13 @@ SpmStopOnIrsVDSCommandParameters params = new SpmStopOnIrsVDSCommandParameters(getStoragePoolForVds().getId(), getParameters().getPreferredSPMId()); - runVdsCommand(VDSCommandType.SpmStopOnIrs, params); + + if (runVdsCommand(VDSCommandType.SpmStopOnIrs, params).getSucceeded()) { + AuditLogDirector.log(this, AuditLogType.USER_FORCE_SELECTED_SPM); + } else { + AuditLogDirector.log(this, AuditLogType.USER_FORCE_SELECTED_SPM_STOP_FAILED); + } + setSucceeded(true); } @@ -87,16 +94,6 @@ storagePoolForVds = getStoragePoolDAO().getForVds(getVds().getId()); } return storagePoolForVds; - } - - @Override - public AuditLogType getAuditLogTypeValue() { - switch (getActionState()) { - case EXECUTE: - return AuditLogType.USER_FORCE_SELECTED_SPM; - default: - return AuditLogType.UNASSIGNED; - } } @Override 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 bf92b37..1db017f 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 @@ -375,7 +375,7 @@ REMOVE_GLUSTER_VOLUME_BRICKS_NOT_FOUND_FROM_CLI(4092, AuditLogSeverity.WARNING), GLUSTER_VOLUME_DETAILS_REFRESH(4093), GLUSTER_VOLUME_DETAILS_REFRESH_FAILED(4094, AuditLogSeverity.ERROR), - + USER_FORCE_SELECTED_SPM_STOP_FAILED(4096), USER_FORCE_SELECTED_SPM(159), USER_VDS_RESTART(41), USER_FAILED_VDS_RESTART(107, AuditLogSeverity.ERROR), 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 20fa6dc..208ec69 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties @@ -207,6 +207,7 @@ USER_VDC_LOGOUT=User ${UserName} logged out. USER_VDC_LOGOUT_FAILED=Failed to log User ${UserName} out. USER_FORCE_SELECTED_SPM=Host ${VdsName} was force selected by ${UserName} +USER_FORCE_SELECTED_SPM_STOP_FAILED=Failed to force select ${VdsName} as the SPM due to a failure to stop the current SPM. USER_VDS_RESTART=Host ${VdsName} was restarted by ${UserName}. USER_VDS_START=Host ${VdsName} was started by ${UserName}. USER_VDS_STOP=Host ${VdsName} was stopped by ${UserName}. -- To view, visit http://gerrit.ovirt.org/31926 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia1a32ec7b68c3643e28751d61ba070b4e4cc09ea Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Liron Aravot <lara...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches