Search in sources :

Example 76 with AuditLogable

use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable 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 77 with AuditLogable

use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.

the class PmHealthCheckManager method addAlert.

private void addAlert(VDS host, AuditLogType auditMessage) {
    AuditLogable alert = new AuditLogableImpl();
    alert.setVdsId(host.getId());
    alert.setVdsName(host.getName());
    alert.setClusterId(host.getClusterId());
    alert.setClusterName(host.getClusterName());
    auditLogDirector.log(alert, auditMessage);
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Example 78 with AuditLogable

use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.

the class DisplayNetworkClusterHelperTest method testWarnOnActiveVmPositive.

/**
 * Test method for
 * {@link org.ovirt.engine.core.bll.network.cluster.helper.DisplayNetworkClusterHelper#warnOnActiveVm()}.
 */
@Test
public void testWarnOnActiveVmPositive() {
    testWarnOnActiveVmInner(true);
    verify(mockAuditLogDirector).log(auditLogableCaptor.capture(), same(AuditLogType.NETWORK_UPDATE_DISPLAY_FOR_CLUSTER_WITH_ACTIVE_VM));
    final AuditLogable actualLoggable = auditLogableCaptor.getValue();
    assertEquals(TEST_CLUSTER_NAME, actualLoggable.getClusterName());
    assertEquals(TEST_NETWORK_NAME, actualLoggable.getCustomValues().get("networkname"));
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) Test(org.junit.Test)

Example 79 with AuditLogable

use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.

the class VdsBrokerCommand method logToAudit.

@Override
protected void logToAudit() {
    if (isPolicyResetMessage(getReturnStatus().message)) {
        return;
    }
    AuditLogable logable = new AuditLogableImpl();
    logable.setVdsId(vds.getId());
    logable.setVdsName(vds.getName());
    logable.addCustomValue("CommandName", getCommandName());
    logable.addCustomValue("message", getReturnStatus().message);
    auditLogDirector.log(logable, AuditLogType.VDS_BROKER_COMMAND_FAILURE);
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Example 80 with AuditLogable

use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.

the class VdsBrokerObjectsBuilder method checkTimeDrift.

public static void checkTimeDrift(VDS vds, Map<String, Object> struct) {
    Boolean isHostTimeDriftEnabled = Config.getValue(ConfigValues.EnableHostTimeDrift);
    if (isHostTimeDriftEnabled) {
        Integer maxTimeDriftAllowed = Config.getValue(ConfigValues.HostTimeDriftInSec);
        Date hostDate = assignDatetimeValue(struct, VdsProperties.hostDatetime);
        if (hostDate != null) {
            Long timeDrift = TimeUnit.MILLISECONDS.toSeconds(Math.abs(hostDate.getTime() - System.currentTimeMillis()));
            if (timeDrift > maxTimeDriftAllowed) {
                AuditLogable logable = createAuditLogableForHost(vds);
                logable.addCustomValue("Actual", timeDrift.toString());
                logable.addCustomValue("Max", maxTimeDriftAllowed.toString());
                auditLogDirector.log(logable, AuditLogType.VDS_TIME_DRIFT_ALERT);
            }
        } else {
            log.error("Time Drift validation: failed to get Host or Engine time.");
        }
    }
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) Date(java.util.Date)

Aggregations

AuditLogable (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable)126 AuditLogableImpl (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)86 AuditLogType (org.ovirt.engine.core.common.AuditLogType)10 AuditLogDirector (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector)9 Guid (org.ovirt.engine.core.compat.Guid)8 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)6 ArrayList (java.util.ArrayList)5 Date (java.util.Date)3 HashMap (java.util.HashMap)3 List (java.util.List)3 Map (java.util.Map)3 Collectors (java.util.stream.Collectors)3 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)3 VDS (org.ovirt.engine.core.common.businessentities.VDS)3 EngineException (org.ovirt.engine.core.common.errors.EngineException)3 HashSet (java.util.HashSet)2 Inject (javax.inject.Inject)2 Singleton (javax.inject.Singleton)2 HostUpgradeManagerResult (org.ovirt.engine.core.common.HostUpgradeManagerResult)2 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)2