Search in sources :

Example 21 with AuditLogable

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

the class UpdateVmCommand method logHotSetActionEvent.

/**
 * add audit log msg for failed hot set in case error was in CDA
 * otherwise internal command will audit log the result
 */
private void logHotSetActionEvent(ActionReturnValue setActionResult, AuditLogType logType) {
    if (!setActionResult.isValid()) {
        AuditLogable logable = new AuditLogableImpl();
        logable.setVmId(getVmId());
        logable.setVmName(getVmName());
        List<String> validationMessages = backend.getErrorsTranslator().translateErrorText(setActionResult.getValidationMessages());
        logable.addCustomValue(HotSetNumberOfCpusCommand.LOGABLE_FIELD_ERROR_MESSAGE, StringUtils.join(validationMessages, ","));
        auditLogDirector.log(logable, logType);
    }
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Example 22 with AuditLogable

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

the class RemoveAuditLogByIdCommand method executeCommand.

@Override
protected void executeCommand() {
    AuditLog auditLog = getAuditLog();
    auditLogDao.remove(getParameters().getAuditLogId());
    setAuditLogDetails(auditLog);
    // clear the id so the auditLog will be considered as a system-level auditLog
    auditLog.setUserId(Guid.Empty);
    AuditLogable logableToClear = createAuditLogableImpl(auditLog);
    // clean cache manager entry (if exists)
    EventFloodRegulator eventFloodRegulator = new EventFloodRegulator(logableToClear, auditLog.getLogType());
    eventFloodRegulator.evict();
    setSucceeded(true);
}
Also used : EventFloodRegulator(org.ovirt.engine.core.dal.dbbroker.auditloghandling.EventFloodRegulator) AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLog(org.ovirt.engine.core.common.businessentities.AuditLog)

Example 23 with AuditLogable

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

the class FenceAgentExecutor method createAuditLogObject.

private AuditLogable createAuditLogObject(FenceActionType action, FenceAgent agent, VDS proxyHost) {
    AuditLogable alb = new AuditLogableImpl();
    alb.addCustomValue("Action", action.name().toLowerCase());
    alb.addCustomValue("Host", fencedHost.getName() == null ? fencedHost.getId().toString() : fencedHost.getName());
    alb.addCustomValue("AgentType", agent.getType());
    alb.addCustomValue("AgentIp", agent.getIp());
    alb.addCustomValue("ProxyHost", proxyHost.getName());
    alb.setVdsId(fencedHost.getId());
    return alb;
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Example 24 with AuditLogable

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

the class PowerSavingBalancePolicyUnit method logAction.

private void logAction(VDS vds, AuditLogType type) {
    AuditLogable loggable = new AuditLogableImpl();
    loggable.addCustomValue("Host", vds.getName());
    loggable.setVdsName(vds.getName());
    loggable.setVdsId(vds.getId());
    loggable.setClusterId(vds.getClusterId());
    loggable.setClusterName(vds.getClusterName());
    Injector.get(AuditLogDirector.class).log(loggable, type);
}
Also used : 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 25 with AuditLogable

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

the class DataCenterCompatibilityChecker method logAlert.

private void logAlert(Version version, StoragePool storagePool) {
    AuditLogable auditLog = new AuditLogableImpl();
    auditLog.setStoragePoolId(storagePool.getId());
    auditLog.setStoragePoolName(storagePool.getName());
    auditLog.addCustomValue("engineVersion", version.toString());
    auditLog.addCustomValue("dcVersion", storagePool.getCompatibilityVersion().toString());
    auditLogDirector.log(auditLog, AuditLogType.STORAGE_POOL_LOWER_THAN_ENGINE_HIGHEST_CLUSTER_LEVEL);
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

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