Search in sources :

Example 31 with AuditLog

use of org.ovirt.engine.core.common.businessentities.AuditLog in project ovirt-engine by oVirt.

the class GlusterUtil method alertVolumeLimitReached.

private boolean alertVolumeLimitReached(final GlusterVolumeEntity volume, boolean checkHardLimit) {
    AuditLogType logType = checkHardLimit ? AuditLogType.GLUSTER_VOLUME_SNAPSHOT_HARD_LIMIT_REACHED : AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED;
    List<AuditLog> limitAlerts = auditLogDao.getByVolumeIdAndType(volume.getId(), logType.getValue());
    if (!limitAlerts.isEmpty()) {
        for (AuditLog alert : limitAlerts) {
            if (!alert.isDeleted()) {
                return true;
            }
        }
    }
    // Alert
    boolean limitReached = checkHardLimit ? glusterDBUtils.isVolumeSnapshotHardLimitReached(volume.getId()) : glusterDBUtils.isVolumeSnapshotSoftLimitReached(volume.getId());
    if (limitReached) {
        glusterAuditLogUtil.logAuditMessage(volume.getClusterId(), volume.getClusterName(), volume, null, logType, volumeAsMap(volume));
        return true;
    }
    return false;
}
Also used : AuditLogType(org.ovirt.engine.core.common.AuditLogType) AuditLog(org.ovirt.engine.core.common.businessentities.AuditLog)

Aggregations

AuditLog (org.ovirt.engine.core.common.businessentities.AuditLog)31 Test (org.junit.Test)13 Date (java.util.Date)6 Guid (org.ovirt.engine.core.compat.Guid)4 AuditLogSeverity (org.ovirt.engine.core.common.AuditLogSeverity)2 AbstractFullDateTimeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractFullDateTimeColumn)2 AuditLogSeverityColumn (org.ovirt.engine.ui.common.widget.table.column.AuditLogSeverityColumn)2 HasClickHandlers (com.google.gwt.event.dom.client.HasClickHandlers)1 EventBus (com.google.gwt.event.shared.EventBus)1 SafeHtmlUtils (com.google.gwt.safehtml.shared.SafeHtmlUtils)1 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 HasData (com.google.gwt.view.client.HasData)1 Inject (com.google.inject.Inject)1 Provider (com.google.inject.Provider)1 Named (com.google.inject.name.Named)1 PresenterWidget (com.gwtplatform.mvp.client.PresenterWidget)1 View (com.gwtplatform.mvp.client.View)1 RevealRootPopupContentEvent (com.gwtplatform.mvp.client.proxy.RevealRootPopupContentEvent)1 Date (java.sql.Date)1 Collection (java.util.Collection)1