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());
}
}
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<>());
}
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);
}
}
}
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);
}
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);
}
}
Aggregations