Search in sources :

Example 6 with AuditLogable

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

the class StorageDomainHelper method checkNumberOfLVsForBlockDomain.

/**
 * If the storage domain given in the parameter is a block domain, the number of LVs on this domain will be fetched
 * and if it exceeds the maximum number of LVs defined in the AlertOnNumberOfLVs config value, an audit log will
 * be logged to indicate that the number of LVs on this domain exceeded the allowed number of LVs
 */
public void checkNumberOfLVsForBlockDomain(Guid storageDomainId) {
    StorageDomainStatic domain = storageDomainStaticDao.get(storageDomainId);
    if (domain.getStorageType().isBlockDomain()) {
        long numOfLVs = storageDomainDao.getNumberOfImagesInStorageDomain(storageDomainId);
        Integer maxNumOfLVs = Config.getValue(ConfigValues.AlertOnNumberOfLVs);
        if (numOfLVs >= maxNumOfLVs) {
            AuditLogable logable = new AuditLogableImpl();
            logable.setStorageDomainName(domain.getName());
            logable.addCustomValue("maxNumOfLVs", maxNumOfLVs.toString());
            logable.setStorageDomainId(storageDomainId);
            auditLogDirector.log(logable, AuditLogType.NUMBER_OF_LVS_ON_STORAGE_DOMAIN_EXCEEDED_THRESHOLD);
        }
    }
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Example 7 with AuditLogable

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

the class VdsNotRespondingTreatmentCommand method logAlert.

private void logAlert(VDS host, int percents) {
    AuditLogable auditLogable = createAuditLogableForHost(host);
    auditLogable.addCustomValue("Percents", String.valueOf(percents));
    auditLogDirector.log(auditLogable, AuditLogType.VDS_ALERT_FENCE_OPERATION_SKIPPED_BROKEN_CONNECTIVITY);
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable)

Example 8 with AuditLogable

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

the class VdsNotRespondingTreatmentCommand method shouldFencingBeSkipped.

private boolean shouldFencingBeSkipped(VDS vds) {
    // check if fencing in cluster is enabled
    Cluster cluster = clusterDao.get(vds.getClusterId());
    if (cluster != null && !cluster.getFencingPolicy().isFencingEnabled()) {
        AuditLogable alb = createAuditLogableForHost(vds);
        auditLogDirector.log(alb, AuditLogType.VDS_ALERT_FENCE_DISABLED_BY_CLUSTER_POLICY);
        return true;
    }
    // check if connectivity is not broken
    if (isConnectivityBrokenThresholdReached(getVds())) {
        return true;
    }
    // fencing will be executed
    return false;
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Example 9 with AuditLogable

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

the class PostDeleteActionHandler method fixDiscardField.

/**
 * Since a storage domain's discard support may be changed since the discard after delete value was chosen by the
 * user, we should check its support before sending it to vdsm. If it doesn't support discard any more, that means
 * that discarding the disk will not work, and we can let the user know about it and send discard=false to vdsm.
 * @param parameters the parameters of the command that should be executed.
 * @param storageDomain the storage domain that the disk or snapshot belongs to.
 * @param <T> the parameters type.
 * @return the fixed parameters.
 */
protected <T extends StoragePoolDomainAndGroupIdBaseVDSCommandParameters & PostDeleteAction> T fixDiscardField(T parameters, StorageDomain storageDomain) {
    if (storageDomain.getDiscardAfterDelete()) {
        if (!Boolean.TRUE.equals(storageDomain.getSupportsDiscard())) {
            parameters.setDiscard(false);
            AuditLogable auditLog = new AuditLogableImpl();
            auditLog.setStorageDomainId(storageDomain.getId());
            auditLogDirector.log(auditLog, AuditLogType.ILLEGAL_STORAGE_DOMAIN_DISCARD_AFTER_DELETE);
        }
    } else if (diskVmElementWithPassDiscardExists(parameters.getImageGroupId()) && Boolean.TRUE.equals(storageDomain.getSupportsDiscard())) {
        // At least one vm has this disk with pass discard enabled.
        // Thus, although the relevant storage domain's discard after
        // delete value is false, we send discard = true to vdsm.
        parameters.setDiscard(true);
    }
    return parameters;
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Example 10 with AuditLogable

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

the class IsoDomainListSynchronizer method addToAuditLogSuccessMessage.

/**
 * Add audit log message when fetch encounter problems.
 */
private void addToAuditLogSuccessMessage(StorageDomain isoDomain, String imageType) {
    AuditLogable logable = new AuditLogableImpl();
    logable.addCustomValue("imageDomains", String.format("%s (%s file type)", isoDomain.getName(), imageType));
    logable.setStorageDomainId(isoDomain.getId());
    logable.setStorageDomainName(isoDomain.getName());
    auditLogDirector.log(logable, AuditLogType.REFRESH_REPOSITORY_IMAGE_LIST_SUCCEEDED);
}
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