Search in sources :

Example 16 with AuditLogable

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

the class GetVmsFullInfoFromExternalProviderVDSCommand method logNonDownVms.

private void logNonDownVms(List<VM> notDownVms) {
    if (!notDownVms.isEmpty()) {
        if (shouldLogToAuditLog()) {
            AuditLogable logable = new AuditLogableImpl();
            logable.addCustomValue("URL", getParameters().getUrl());
            logable.addCustomValue("Vms", StringUtils.join(notDownVms, ","));
            auditLogDirector.log(logable, AuditLogType.IMPORTEXPORT_GET_EXTERNAL_VMS_NOT_IN_DOWN_STATUS);
        } else {
            log.warn("The following VMs retrieved from external server '{}' are not in down status and therefore can't be imported: '{}'.", getParameters().getUrl(), StringUtils.join(notDownVms, ","));
        }
    }
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Example 17 with AuditLogable

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

the class HostNetworkTopologyPersisterImpl method logChangedDisplayNetwork.

private void logChangedDisplayNetwork(VDS host, Collection<Network> engineHostNetworks, Collection<VdsNetworkInterface> engineInterfaces) {
    if (isVmRunningOnHost(host.getId())) {
        final Network engineDisplayNetwork = findDisplayNetwork(host.getClusterId(), engineHostNetworks);
        if (engineDisplayNetwork == null) {
            return;
        }
        final IsNetworkOnInterfacePredicate isNetworkOnInterfacePredicate = new IsNetworkOnInterfacePredicate(engineDisplayNetwork.getName());
        final VdsNetworkInterface vdsmDisplayInterface = host.getInterfaces().stream().filter(isNetworkOnInterfacePredicate).findFirst().orElse(null);
        final VdsNetworkInterface engineDisplayInterface = engineInterfaces.stream().filter(isNetworkOnInterfacePredicate).findFirst().orElse(null);
        final DisplayInterfaceEqualityPredicate displayIneterfaceEqualityPredicate = new DisplayInterfaceEqualityPredicate(engineDisplayInterface);
        if (// the display interface is't on host anymore
        vdsmDisplayInterface == null || !displayIneterfaceEqualityPredicate.test(vdsmDisplayInterface)) {
            final AuditLogable loggable = createAuditLogForHost(host);
            auditLogDirector.log(loggable, AuditLogType.NETWORK_UPDATE_DISPLAY_FOR_HOST_WITH_ACTIVE_VM);
        }
    }
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) Network(org.ovirt.engine.core.common.businessentities.network.Network) DisplayInterfaceEqualityPredicate(org.ovirt.engine.core.vdsbroker.vdsbroker.predicates.DisplayInterfaceEqualityPredicate) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) IsNetworkOnInterfacePredicate(org.ovirt.engine.core.vdsbroker.vdsbroker.predicates.IsNetworkOnInterfacePredicate)

Example 18 with AuditLogable

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

the class HostNetworkTopologyPersisterImpl method createAuditLogForHost.

private AuditLogable createAuditLogForHost(VDS host) {
    final AuditLogable loggable = new AuditLogableImpl();
    loggable.setVdsId(host.getId());
    loggable.setVdsName(host.getName());
    return loggable;
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Example 19 with AuditLogable

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

the class AutoStartVmsRunner method createVmEvent.

private AuditLogable createVmEvent(Guid vmId) {
    AuditLogable event = new AuditLogableImpl();
    event.setVmId(vmId);
    event.setVmName(resourceManager.getVmManager(vmId).getName());
    return event;
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Example 20 with AuditLogable

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

the class AutoStartVmsRunner method logVmEvent.

private void logVmEvent(Guid vmId, AuditLogType restartFailedAuditLogType) {
    AuditLogable event = createVmEvent(vmId);
    auditLogDirector.log(event, restartFailedAuditLogType);
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable)

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