Search in sources :

Example 16 with AuditLogableBase

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

the class AddExternalEventCommand method executeCommand.

@Override
protected void executeCommand() {
    AuditLogableBase event = Injector.injectMembers(new AuditLogableBase(getParameters().getEvent()));
    event.setExternal(true);
    String message = StringUtils.abbreviate(getEvent().getMessage(), Config.getValue(ConfigValues.MaxAuditLogMessageLength));
    switch(getEvent().getSeverity()) {
        case NORMAL:
            auditLogDirector.log(event, AuditLogType.EXTERNAL_EVENT_NORMAL, message);
            break;
        case WARNING:
            auditLogDirector.log(event, AuditLogType.EXTERNAL_EVENT_WARNING, message);
            break;
        case ERROR:
            auditLogDirector.log(event, AuditLogType.EXTERNAL_EVENT_ERROR, message);
            break;
        case ALERT:
            auditLogDirector.log(event, AuditLogType.EXTERNAL_ALERT, message);
            break;
    }
    AuditLog auditLog = auditLogDao.getByOriginAndCustomEventId(getEvent().getOrigin(), getEvent().getCustomEventId());
    if (auditLog != null) {
        setActionReturnValue(auditLog.getAuditLogId());
        setSucceeded(true);
    }
    // Update host external status if set
    if (hasHostExternalStatus()) {
        vdsDynamicDao.updateExternalStatus(getEvent().getVdsId(), getParameters().getExternalStatus());
    }
    // update storage domain external status if set
    if (hasStorageDomainExternalStatus()) {
        storageDomainDynamicDao.updateExternalStatus(getEvent().getStorageDomainId(), getParameters().getExternalStatus());
    }
}
Also used : AuditLogableBase(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase) AuditLog(org.ovirt.engine.core.common.businessentities.AuditLog)

Example 17 with AuditLogableBase

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

the class QuotaManagerTest method setUp.

@Before
public void setUp() {
    setStoragePool();
    mockQuotaDao();
    doReturn(quotaDao).when(quotaManager).getQuotaDao();
    doReturn(quotaManagerAuditLogger).when(quotaManager).getQuotaManagerAuditLogger();
    doNothing().when(quotaManagerAuditLogger).auditLog(any(), any());
    AuditLogableBase auditLogable = new AuditLogableBase();
    auditLogable.setStoragePool(storage_pool);
    parametersWrapper = new QuotaConsumptionParametersWrapper(auditLogable, validationMessages);
    parametersWrapper.setParameters(new ArrayList<>());
}
Also used : AuditLogableBase(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase) Before(org.junit.Before)

Example 18 with AuditLogableBase

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

the class BalloonMonitoring method vmBalloonDriverIsRequestedAndUnavailable.

// add the vm to the list of vms with balloon driver problem or increment its counter
// if it is already in the list
private void vmBalloonDriverIsRequestedAndUnavailable(Guid vmId) {
    Integer currentVal = vmsWithBalloonDriverProblem.get(vmId);
    if (currentVal == null) {
        vmsWithBalloonDriverProblem.put(vmId, 1);
    } else {
        vmsWithBalloonDriverProblem.put(vmId, currentVal + 1);
        if (currentVal >= Config.<Integer>getValue(ConfigValues.IterationsWithBalloonProblem)) {
            AuditLogableBase auditLogable = Injector.injectMembers(new AuditLogableBase());
            auditLogable.setVmId(vmId);
            auditLog(auditLogable, AuditLogType.VM_BALLOON_DRIVER_ERROR);
            vmsWithBalloonDriverProblem.put(vmId, 0);
        }
    }
}
Also used : AuditLogableBase(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase)

Example 19 with AuditLogableBase

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

the class VmAnalyzer method auditVmPaused.

private void auditVmPaused() {
    AuditLogableBase logable = Injector.injectMembers(new AuditLogableBase(vdsManager.getVdsId(), dbVm.getId()));
    auditLog(logable, AuditLogType.VM_PAUSED);
}
Also used : AuditLogableBase(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase)

Example 20 with AuditLogableBase

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

the class VmAnalyzer method proceedWatchdogEvents.

private void proceedWatchdogEvents() {
    VmDynamic vmDynamic = vdsmVm.getVmDynamic();
    if (isNewWatchdogEvent(vmDynamic, dbVm)) {
        AuditLogableBase auditLogable = Injector.injectMembers(new AuditLogableBase());
        auditLogable.setVmId(vmDynamic.getId());
        auditLogable.addCustomValue("wdaction", vmDynamic.getLastWatchdogAction());
        // for the interpretation of vdsm's response see http://docs.python.org/2/library/time.html
        auditLogable.addCustomValue("wdevent", new Date(vmDynamic.getLastWatchdogEvent() * 1000).toString());
        auditLog(auditLogable, AuditLogType.WATCHDOG_EVENT);
    }
}
Also used : AuditLogableBase(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase) VmDynamic(org.ovirt.engine.core.common.businessentities.VmDynamic) Date(java.util.Date)

Aggregations

AuditLogableBase (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase)22 AuditLogType (org.ovirt.engine.core.common.AuditLogType)3 VmDynamic (org.ovirt.engine.core.common.businessentities.VmDynamic)2 Guid (org.ovirt.engine.core.compat.Guid)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 Before (org.junit.Before)1 ProcessDownVmParameters (org.ovirt.engine.core.common.action.ProcessDownVmParameters)1 AuditLog (org.ovirt.engine.core.common.businessentities.AuditLog)1 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)1 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)1 VDS (org.ovirt.engine.core.common.businessentities.VDS)1 VM (org.ovirt.engine.core.common.businessentities.VM)1 VmBalloonInfo (org.ovirt.engine.core.common.businessentities.VmBalloonInfo)1 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)1 Pair (org.ovirt.engine.core.common.utils.Pair)1 SetVmStatusVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.SetVmStatusVDSCommandParameters)1 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)1 AuditLogDirector (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector)1