Maor Lipchuk has uploaded a new change for review. Change subject: core [iSCSI multipath]: Add audit log when encounter connection issues ......................................................................
core [iSCSI multipath]: Add audit log when encounter connection issues Adding an audit log when updating/adding an iSCSI multipath and some of the hosts encounter some connection issues to the Storage Domain through some of the netwokrs interfaces. Also adding a log to indicate which connections were problematic. Change-Id: I8951c9b6667abb33ee6dbd0d7d8c4c98d53a3227 Bug-Url: https://bugzilla.redhat.com/1094033 Signed-off-by: Maor Lipchuk <mlipc...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddIscsiBondCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/BaseIscsiBondCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/EditIscsiBondCommand.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 5 files changed, 40 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/92/31092/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddIscsiBondCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddIscsiBondCommand.java index 2e26558..123d430 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddIscsiBondCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddIscsiBondCommand.java @@ -73,7 +73,13 @@ @Override public AuditLogType getAuditLogTypeValue() { - return getSucceeded() ? AuditLogType.ISCSI_BOND_ADD_SUCCESS : AuditLogType.ISCSI_BOND_ADD_FAILED; + if (getSucceeded()) { + if (encounterConnectionProblems) { + return AuditLogType.ISCSI_BOND_ADD_SUCCESS_WITH_WARNING; + } + return AuditLogType.ISCSI_BOND_ADD_SUCCESS; + } + return AuditLogType.ISCSI_BOND_ADD_FAILED; } @Override diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/BaseIscsiBondCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/BaseIscsiBondCommand.java index 37ed1fb..09f0422 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/BaseIscsiBondCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/BaseIscsiBondCommand.java @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.concurrent.Callable; import org.ovirt.engine.core.bll.CommandBase; @@ -17,10 +18,15 @@ import org.ovirt.engine.core.common.errors.VdcBLLException; import org.ovirt.engine.core.common.vdscommands.StorageServerConnectionManagementVDSParameters; import org.ovirt.engine.core.common.vdscommands.VDSCommandType; +import org.ovirt.engine.core.common.vdscommands.VDSReturnValue; import org.ovirt.engine.core.compat.Guid; +import org.ovirt.engine.core.utils.linq.LinqUtils; +import org.ovirt.engine.core.utils.linq.Predicate; import org.ovirt.engine.core.utils.threadpool.ThreadPoolUtil; public abstract class BaseIscsiBondCommand<T extends VdcActionParametersBase> extends CommandBase<T> { + + protected boolean encounterConnectionProblems = false; public BaseIscsiBondCommand(T parameters) { super(parameters); @@ -47,14 +53,29 @@ public Void call() throws Exception { try { final List<StorageServerConnections> conns = ISCSIStorageHelper.updateIfaces(connections, host.getId()); - runVdsCommand(VDSCommandType.ConnectStorageServer, + VDSReturnValue returnValue = runVdsCommand(VDSCommandType.ConnectStorageServer, new StorageServerConnectionManagementVDSParameters(host.getId(), Guid.Empty, StorageType.ISCSI, conns) ); + final Map<String, String> iscsiMap = (Map<String, String>) returnValue.getReturnValue(); + List<String> failedConnectionsList = LinqUtils.filter(iscsiMap.keySet(), new Predicate<String>() { + @Override + public boolean eval(String a) { + return !"0".equals(iscsiMap.get(a)); + } + }); + if (!failedConnectionsList.isEmpty()) { + log.errorFormat("Host {0} - {1} encounter problems to connect to the Iscsi Storage Server. The following connections were problematic (connectionid=vdsm result): {2}", + host.getName(), + host.getId(), + iscsiMap.toString()); + encounterConnectionProblems = true; + } } catch (VdcBLLException e) { log.errorFormat("Could not connect Host {0} - {1} to Iscsi Storage Server. The exception is: {2}", host.getName(), host.getId(), e); + encounterConnectionProblems = true; } return null; } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/EditIscsiBondCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/EditIscsiBondCommand.java index ded5740..8d4529f 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/EditIscsiBondCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/EditIscsiBondCommand.java @@ -151,7 +151,13 @@ @Override public AuditLogType getAuditLogTypeValue() { - return getSucceeded() ? AuditLogType.ISCSI_BOND_EDIT_SUCCESS : AuditLogType.ISCSI_BOND_EDIT_FAILED; + if (getSucceeded()) { + if (encounterConnectionProblems) { + return AuditLogType.ISCSI_BOND_EDIT_SUCCESS_WITH_WARNING; + } + return AuditLogType.ISCSI_BOND_EDIT_SUCCESS; + } + return AuditLogType.ISCSI_BOND_EDIT_FAILED; } @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 7719bf3..8863e32 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 @@ -1015,8 +1015,10 @@ // iSCSI bond ISCSI_BOND_ADD_SUCCESS(10400), + ISCSI_BOND_ADD_SUCCESS_WITH_WARNING(10407, AuditLogSeverity.WARNING), ISCSI_BOND_ADD_FAILED(10401, AuditLogSeverity.ERROR), ISCSI_BOND_EDIT_SUCCESS(10402), + ISCSI_BOND_EDIT_SUCCESS_WITH_WARNING(10406, AuditLogSeverity.WARNING), ISCSI_BOND_EDIT_FAILED(10403, AuditLogSeverity.ERROR), ISCSI_BOND_REMOVE_SUCCESS(10404), ISCSI_BOND_REMOVE_FAILED(10405, 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 c4215e2..bbcf2d6 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties @@ -828,8 +828,10 @@ USER_FAILED_TO_SET_HOSTED_ENGINE_MAINTENANCE=Hosted Engine HA maintenance mode could not be updated on host ${VdsName}. ISCSI_BOND_ADD_SUCCESS=iSCSI bond '${IscsiBondName}' was successfully created in Data Center '${StoragePoolName}'. +ISCSI_BOND_ADD_SUCCESS_WITH_WARNING=iSCSI bond '${IscsiBondName}' was successfully created in Data Center '${StoragePoolName}' but some of the hosts encountered connection issues. ISCSI_BOND_ADD_FAILED=Failed to create iSCSI bond '${IscsiBondName}' in Data Center '${StoragePoolName}'. ISCSI_BOND_EDIT_SUCCESS=iSCSI bond '${IscsiBondName}' was successfully updated. +ISCSI_BOND_EDIT_SUCCESS_WITH_WARNING=iSCSI bond '${IscsiBondName}' was successfully updated but some of the hosts encountered connection issues. ISCSI_BOND_EDIT_FAILED=Failed to update iSCSI bond '${IscsiBondName}'. ISCSI_BOND_REMOVE_SUCCESS=iSCSI bond '${IscsiBondName}' was removed from Data Center '${StoragePoolName}' ISCSI_BOND_REMOVE_FAILED=Failed to remove iSCSI bond '${IscsiBondName}' from Data Center '${StoragePoolName}' -- To view, visit http://gerrit.ovirt.org/31092 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8951c9b6667abb33ee6dbd0d7d8c4c98d53a3227 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Maor Lipchuk <mlipc...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches