Tal Nisan has uploaded a new change for review. Change subject: core: Added log for storage connection error (#854210) ......................................................................
core: Added log for storage connection error (#854210) Added a log entry when a VDS connect to storage domains is unsuccessful which contains the failed storage domains names Change-Id: Ib412608941f1223eb52bbde85ef7ece52c64ec0f Bug-Url: https://bugzilla.redhat.com/854210 Signed-off-by: Tal Nisan <[email protected]> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java M backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/ConnectStorageServerVDSCommand.java 4 files changed, 36 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/05/8605/1 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 828fde8..5b7f7c6 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 @@ -42,6 +42,7 @@ VDS_CPU_LOWER_THAN_CLUSTER(515), VDS_CPU_RETRIEVE_FAILED(516), VDS_STORAGE_CONNECTION_FAILED_BUT_LAST_VDS(533), + VDS_STORAGES_CONNECTION_FAILED(535), VDS_STORAGE_VDS_STATS_FAILED(534), VDS_SET_NONOPERATIONAL(517, AuditLogTimeInterval.MINUTE.getValue()), VDS_SET_NONOPERATIONAL_FAILED(518, AuditLogTimeInterval.MINUTE.getValue()), diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java index e1bfbd3..9eefdc1 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java @@ -264,6 +264,7 @@ mSeverities.put(AuditLogType.VDS_ALERT_FENCING_NO_PROXY_HOST, AuditLogSeverity.NORMAL); mSeverities.put(AuditLogType.VDS_LOW_MEM, AuditLogSeverity.WARNING); mSeverities.put(AuditLogType.VDS_STORAGE_CONNECTION_FAILED_BUT_LAST_VDS, AuditLogSeverity.ERROR); + mSeverities.put(AuditLogType.VDS_STORAGES_CONNECTION_FAILED, AuditLogSeverity.ERROR); mSeverities.put(AuditLogType.VDS_STORAGE_VDS_STATS_FAILED, AuditLogSeverity.ERROR); mSeverities.put(AuditLogType.VDS_LOW_DISK_SPACE, AuditLogSeverity.WARNING); mSeverities.put(AuditLogType.VDS_LOW_DISK_SPACE_ERROR, 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 f97fa1b..e3b8ee3 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties @@ -362,6 +362,7 @@ VDS_CPU_RETRIEVE_FAILED=Failed to determine Host ${VdsName} CPU level - could not retrieve CPU flags. VDS_STORAGE_CONNECTION_FAILED_BUT_LAST_VDS=Failed to connect Host ${VdsName} to Data Center, due to connectivity errors with the Storage. Host ${VdsName} will remain in Up state (but inactive), as it is the last Host in the Data Center, to enable manual intervention by the Administrator. VDS_STORAGE_VDS_STATS_FAILED=Host ${VdsName} reports about one of the Active Storage Domains as Problematic. +VDS_STORAGES_CONNECTION_FAILED=Failed to connect Host ${VdsName} to the Storage Domains ${failedStorageDomains}. VDS_SET_NONOPERATIONAL=Host ${VdsName} moved to Non-Operational state. VDS_SET_NONOPERATIONAL_FAILED=Failed to move Host ${VdsName} to Non-Operational state. VDS_FENCE_STATUS=Host ${VdsName} power management was verified successfully. diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/ConnectStorageServerVDSCommand.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/ConnectStorageServerVDSCommand.java index 0a30935..6e7b57f 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/ConnectStorageServerVDSCommand.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/ConnectStorageServerVDSCommand.java @@ -1,9 +1,12 @@ package org.ovirt.engine.core.vdsbroker.vdsbroker; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.apache.commons.lang.StringUtils; +import org.ovirt.engine.core.common.AuditLogType; +import org.ovirt.engine.core.common.businessentities.storage_domains; import org.ovirt.engine.core.common.businessentities.storage_pool; import org.ovirt.engine.core.common.businessentities.storage_server_connections; import org.ovirt.engine.core.common.config.Config; @@ -11,6 +14,8 @@ import org.ovirt.engine.core.common.vdscommands.ConnectStorageServerVDSCommandParameters; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.dal.dbbroker.DbFacade; +import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector; +import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase; public class ConnectStorageServerVDSCommand<P extends ConnectStorageServerVDSCommandParameters> extends VdsBrokerCommand<P> { @@ -25,7 +30,9 @@ _result = getBroker().connectStorageServer(getParameters().getStorageType().getValue(), getParameters().getStoragePoolId().toString(), BuildStructFromConnectionListObject()); ProceedProxyReturnValue(); - setReturnValue(_result.convertToStatusList()); + Map<String, String> returnValue = _result.convertToStatusList(); + setReturnValue(returnValue); + logFailedStorageConnections(returnValue); } @SuppressWarnings("unchecked") @@ -86,6 +93,31 @@ return con; } + private void logFailedStorageConnections(Map<String, String> returnValue) { + String failedDomainNames = ""; + String namesSeparator = ","; + for (String storageId : returnValue.keySet()) { + if (!"0".equals(returnValue.get(storageId))) { + List<storage_domains> domains = + DbFacade.getInstance().getStorageDomainDao().getAllByConnectionId(new Guid(storageId)); + if (!domains.isEmpty()) { + for (storage_domains domain : domains) { + if (!failedDomainNames.isEmpty()) { + failedDomainNames += namesSeparator; + } + failedDomainNames += domain.getstorage_name(); + } + } + } + } + + if (!failedDomainNames.isEmpty()) { + AuditLogableBase logable = new AuditLogableBase(getParameters().getVdsId()); + logable.AddCustomValue("failedStorageDomains", failedDomainNames); + AuditLogDirector.log(logable, AuditLogType.VDS_STORAGES_CONNECTION_FAILED); + } + } + @Override protected StatusForXmlRpc getReturnStatus() { return _result.mStatus; -- To view, visit http://gerrit.ovirt.org/8605 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib412608941f1223eb52bbde85ef7ece52c64ec0f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Tal Nisan <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
