Search in sources :

Example 11 with AuditLogType

use of org.ovirt.engine.core.common.AuditLogType in project ovirt-engine by oVirt.

the class UpgradeOvirtNodeInternalCommand method getAuditLogTypeValue.

@Override
public AuditLogType getAuditLogTypeValue() {
    AuditLogType result = null;
    if (getSucceeded()) {
        result = AuditLogType.VDS_INSTALL;
    } else {
        // In case of failure - add to audit log the error as achieved from
        // the host
        addCustomValue("FailedInstallMessage", getErrorMessage(_failureMessage));
        result = AuditLogType.VDS_INSTALL_FAILED;
    }
    return result;
}
Also used : AuditLogType(org.ovirt.engine.core.common.AuditLogType)

Example 12 with AuditLogType

use of org.ovirt.engine.core.common.AuditLogType in project ovirt-engine by oVirt.

the class VdsDeploy method userVisibleLog.

@Override
public void userVisibleLog(Level level, String message) {
    if (!_alertLog) {
        super.userVisibleLog(level, message);
    } else {
        AuditLogType type = _levelToType.get(level);
        if (type == null) {
            log.debug(message);
        } else {
            AuditLogable logable = new AuditLogableImpl();
            logable.setVdsId(getVds().getId());
            logable.setVdsName(getVds().getName());
            logable.setClusterId(getVds().getClusterId());
            logable.setClusterName(getVds().getClusterName());
            logable.setCorrelationId(getCorrelationId());
            logable.addCustomValue("Message", message);
            Injector.get(AuditLogDirector.class).log(logable, _levelToType.get(level));
        }
    }
}
Also used : AuditLogType(org.ovirt.engine.core.common.AuditLogType) AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl) AuditLogDirector(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector)

Example 13 with AuditLogType

use of org.ovirt.engine.core.common.AuditLogType in project ovirt-engine by oVirt.

the class AuditLogableBaseTest method auditLogTypeValue.

@Test
public void auditLogTypeValue() {
    final AuditLogType t = b.getAuditLogTypeValue();
    assertEquals(AuditLogType.UNASSIGNED, t);
}
Also used : AuditLogType(org.ovirt.engine.core.common.AuditLogType) Test(org.junit.Test)

Example 14 with AuditLogType

use of org.ovirt.engine.core.common.AuditLogType in project ovirt-engine by oVirt.

the class VdsManager method logChangeStatusToConnecting.

private void logChangeStatusToConnecting() {
    long timeoutToFence = calcTimeoutToFence(cachedVds.getVmCount(), cachedVds.getSpmStatus());
    String msg;
    AuditLogType auditLogType;
    if (cachedVds.isPmEnabled()) {
        msg = "Host '{}' is not responding. It will stay in Connecting state for a grace period " + "of {} seconds and after that an attempt to fence the host will be issued.";
        auditLogType = AuditLogType.VDS_HOST_NOT_RESPONDING_CONNECTING;
        log.warn(msg, cachedVds.getName(), TimeUnit.MILLISECONDS.toSeconds(timeoutToFence));
    } else {
        msg = "Host '{}' is not responding.";
        auditLogType = AuditLogType.VDS_HOST_NOT_RESPONDING;
        log.warn(msg, cachedVds.getName());
    }
    AuditLogable logable = createAuditLogableForHost(cachedVds);
    logable.addCustomValue("Seconds", Long.toString(TimeUnit.MILLISECONDS.toSeconds(timeoutToFence)));
    auditLogDirector.log(logable, auditLogType);
}
Also used : AuditLogType(org.ovirt.engine.core.common.AuditLogType) AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable)

Example 15 with AuditLogType

use of org.ovirt.engine.core.common.AuditLogType in project ovirt-engine by oVirt.

the class MoveImageGroupCommand method addAuditLogOnRemoveFailure.

private void addAuditLogOnRemoveFailure() {
    addCustomValue("DiskAlias", getDiskImage().getDiskAlias());
    addCustomValue("StorageDomainName", getStorageDomain().getStorageName());
    AuditLogType logType = null;
    if (getActionState() == CommandActionState.END_SUCCESS) {
        logType = AuditLogType.USER_MOVE_IMAGE_GROUP_FAILED_TO_DELETE_SRC_IMAGE;
    } else {
        logType = AuditLogType.USER_MOVE_IMAGE_GROUP_FAILED_TO_DELETE_DST_IMAGE;
    }
    auditLogDirector.log(this, logType);
}
Also used : AuditLogType(org.ovirt.engine.core.common.AuditLogType)

Aggregations

AuditLogType (org.ovirt.engine.core.common.AuditLogType)23 AuditLogable (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable)8 AuditLogableImpl (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)5 AuditLogDirector (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector)4 AuditLogableBase (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase)3 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)2 StandardCharsets (java.nio.charset.StandardCharsets)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 MissingResourceException (java.util.MissingResourceException)1 Objects (java.util.Objects)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Inject (javax.inject.Inject)1