Search in sources :

Example 31 with AuditLogableImpl

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

the class ExternalSchedulerDiscovery method discover.

/**
 * Discover external schedulers and process its policy units. This operation may take time and is recommended to run
 * in a different thread. If we found new policy units we save them to db and expose them for usage.
 *
 * @return {@code true} if new policies where found and saved to db, {@code false} otherwise.
 */
public boolean discover() {
    boolean dbUpdated;
    Optional<ExternalSchedulerDiscoveryResult> discoveryResult = broker.runDiscover();
    if (discoveryResult.isPresent()) {
        updateDB(discoveryResult.get());
        log.debug("PolicyUnits updated for external broker.");
        dbUpdated = true;
    } else {
        AuditLogable loggable = new AuditLogableImpl();
        auditLogDirector.log(loggable, AuditLogType.FAILED_TO_CONNECT_TO_SCHEDULER_PROXY);
        log.warn("Discovery returned empty result when talking to broker. Disabling external units");
        List<PolicyUnit> failingPolicyUnits = policyUnitDao.getAll().stream().collect(Collectors.toList());
        markExternalPoliciesAsDisabled(failingPolicyUnits);
        dbUpdated = true;
    }
    return dbUpdated;
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl) PolicyUnit(org.ovirt.engine.core.common.scheduling.PolicyUnit)

Example 32 with AuditLogableImpl

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

the class BlockStorageDiscardFunctionalityHelper method logLunsBrokeStorageDomainDiscardAfterDeleteSupport.

private void logLunsBrokeStorageDomainDiscardAfterDeleteSupport(Collection<LUNs> lunsThatBreakSdDiscardAfterDeleteSupport, StorageDomain storageDomain) {
    AuditLogable auditLog = new AuditLogableImpl();
    auditLog.setStorageDomainId(storageDomain.getId());
    auditLog.setStorageDomainName(storageDomain.getName());
    auditLog.addCustomValue("LunsIds", lunsThatBreakSdDiscardAfterDeleteSupport.stream().map(LUNs::getLUNId).collect(Collectors.joining(", ")));
    auditLogDirector.log(auditLog, AuditLogType.LUNS_BROKE_SD_DISCARD_AFTER_DELETE_SUPPORT);
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Example 33 with AuditLogableImpl

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

the class BlockStorageDiscardFunctionalityHelper method logLunsBrokeStorageDomainPassDiscardSupport.

private void logLunsBrokeStorageDomainPassDiscardSupport(Collection<LUNs> lunsThatBreakSdPassDiscardSupport, StorageDomain storageDomain) {
    AuditLogable auditLog = new AuditLogableImpl();
    auditLog.setStorageDomainId(storageDomain.getId());
    auditLog.setStorageDomainName(storageDomain.getName());
    auditLog.addCustomValue("LunsIds", lunsThatBreakSdPassDiscardSupport.stream().map(LUNs::getLUNId).collect(Collectors.joining(", ")));
    auditLogDirector.log(auditLog, AuditLogType.LUNS_BROKE_SD_PASS_DISCARD_SUPPORT);
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Example 34 with AuditLogableImpl

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

the class GlusterAuditLogUtil method createEvent.

private AuditLogable createEvent(GlusterVolumeEntity volume, VDS server, Guid clusterId, String clusterName) {
    AuditLogable logable = new AuditLogableImpl();
    if (server != null) {
        logable.setVdsId(server.getId());
        logable.setVdsName(server.getName());
    }
    if (volume != null) {
        logable.setGlusterVolumeId(volume.getId());
        logable.setGlusterVolumeName(volume.getName());
    }
    logable.setClusterId(clusterId);
    logable.setClusterName(clusterName);
    return logable;
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Example 35 with AuditLogableImpl

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

the class GlusterEventFactory method createEvent.

public static AuditLogable createEvent(VDS vds, VDSReturnValue returnValue) {
    AuditLogable logable = new AuditLogableImpl();
    logable.setVdsId(vds.getId());
    logable.setVdsName(vds.getName());
    logable.setClusterId(vds.getClusterId());
    logable.setClusterName(vds.getClusterName());
    logable.addCustomValue("ErrorMessage", returnValue.getVdsError().getMessage());
    logable.updateCallStackFromThrowable(returnValue.getExceptionObject());
    return logable;
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Aggregations

AuditLogableImpl (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)88 AuditLogable (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable)85 AuditLogDirector (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector)8 AuditLogType (org.ovirt.engine.core.common.AuditLogType)6 Guid (org.ovirt.engine.core.compat.Guid)5 EngineException (org.ovirt.engine.core.common.errors.EngineException)4 HostUpgradeManagerResult (org.ovirt.engine.core.common.HostUpgradeManagerResult)3 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)3 AnsibleCommandBuilder (org.ovirt.engine.core.common.utils.ansible.AnsibleCommandBuilder)3 AnsibleReturnValue (org.ovirt.engine.core.common.utils.ansible.AnsibleReturnValue)3 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)2 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)2 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)2 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)2 LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)2 Event (org.ovirt.engine.core.common.eventqueue.Event)2