Search in sources :

Example 66 with AuditLogableImpl

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

the class IrsProxy method reconstructMasterDomainNotInSync.

/**
 * Reconstructs the master domain when the old domain is not in sync.
 *
 * @param storagePoolId
 *            The storage pool id.
 * @param masterDomain
 *            The master domain.
 * @param exceptionMessage
 *            The message of the exception to throw.
 * @param logMessage
 *            The log message to write in the log.
 */
private void reconstructMasterDomainNotInSync(final Guid storagePoolId, final StorageDomainStatic masterDomain, final String exceptionMessage, final String logMessage) {
    getEventQueue().submitEventSync(new Event(this.storagePoolId, masterDomain.getId(), null, EventType.RECONSTRUCT, "Reconstruct caused by failure to execute spm command"), () -> {
        log.warn(logMessage);
        AuditLogable logable = new AuditLogableImpl();
        logable.setVdsId(currentVdsId);
        logable.setVdsName(vdsStaticDao.get(currentVdsId).getName());
        logable.setStorageDomainId(masterDomain.getId());
        logable.setStorageDomainName(masterDomain.getName());
        auditLogDirector.log(logable, AuditLogType.SYSTEM_MASTER_DOMAIN_NOT_IN_SYNC);
        return getEventListener().masterDomainNotOperational(masterDomain.getId(), storagePoolId, false, true);
    });
    throw new IRSNoMasterDomainException(exceptionMessage);
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) Event(org.ovirt.engine.core.common.eventqueue.Event) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Example 67 with AuditLogableImpl

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

the class SingleAgentFenceActionExecutor method auditVerifyStatusRetryLimitExceeded.

protected void auditVerifyStatusRetryLimitExceeded(FenceActionType fenceAction) {
    AuditLogable auditLogable = new AuditLogableImpl();
    auditLogable.addCustomValue("Host", fencedHost.getName());
    auditLogable.addCustomValue("Status", fenceAction.name().toLowerCase());
    auditLogable.setVdsId(fencedHost.getId());
    auditLogable.setVdsName(fencedHost.getName());
    getAuditLogDirector().log(auditLogable, AuditLogType.VDS_ALERT_FENCE_STATUS_VERIFICATION_FAILED);
    log.error("Failed to verify host '{}' status after {} action: have retried {} times with delay of {} seconds" + " between each retry.", fencedHost.getHostName(), fenceAction.name(), allowedWaitForStatusRetries, delayBetweenRetries);
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Example 68 with AuditLogableImpl

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

the class VdsNotRespondingTreatmentCommand method createAuditLogableForHost.

private AuditLogable createAuditLogableForHost(VDS vds) {
    AuditLogable logable = new AuditLogableImpl();
    logable.setVdsId(vds.getId());
    logable.setVdsName(vds.getName());
    logable.setClusterId(vds.getClusterId());
    logable.setClusterName(vds.getClusterName());
    logable.setRepeatable(true);
    return logable;
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Example 69 with AuditLogableImpl

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

the class BlockStorageDiscardFunctionalityHelper method logIfDisksWithIllegalPassDiscardExist.

public void logIfDisksWithIllegalPassDiscardExist(Guid vmId) {
    Collection<DiskImage> disks = DisksFilter.filterImageDisks(diskDao.getAllForVm(vmId));
    Collection<DiskVmElement> diskVmElements = diskVmElementDao.getAllForVm(vmId);
    Map<Disk, DiskVmElement> diskToDiskVmElement = diskHandler.getDiskToDiskVmElementMap(disks, diskVmElements);
    Map<Guid, Guid> diskIdToDestSdId = disks.stream().collect(Collectors.toMap(DiskImage::getId, diskImage -> diskImage.getStorageIds().get(0)));
    MultipleDiskVmElementValidator multipleDiskVmElementValidator = new MultipleDiskVmElementValidator(diskToDiskVmElement);
    Collection<Guid> disksWithoutSupportForPassDiscard = multipleDiskVmElementValidator.getDisksWithoutSupportForPassDiscard(diskIdToDestSdId);
    if (!disksWithoutSupportForPassDiscard.isEmpty()) {
        AuditLogable auditLog = new AuditLogableImpl();
        auditLog.addCustomValue("DisksIds", disksWithoutSupportForPassDiscard.stream().map(Guid::toString).collect(Collectors.joining(", ")));
        auditLogDirector.log(auditLog, AuditLogType.DISKS_WITH_ILLEGAL_PASS_DISCARD_EXIST);
    }
}
Also used : DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) Guid(org.ovirt.engine.core.compat.Guid) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) Singleton(javax.inject.Singleton) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) Inject(javax.inject.Inject) MultipleDiskVmElementValidator(org.ovirt.engine.core.bll.validator.storage.MultipleDiskVmElementValidator) DisksFilter(org.ovirt.engine.core.bll.storage.disk.image.DisksFilter) DiskImageDao(org.ovirt.engine.core.dao.DiskImageDao) Map(java.util.Map) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl) AuditLogDirector(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector) Collection(java.util.Collection) EngineMessage(org.ovirt.engine.core.common.errors.EngineMessage) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) DiskVmElementDao(org.ovirt.engine.core.dao.DiskVmElementDao) Collectors(java.util.stream.Collectors) AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) DiskHandler(org.ovirt.engine.core.bll.storage.disk.DiskHandler) List(java.util.List) DiskDao(org.ovirt.engine.core.dao.DiskDao) ValidationResult(org.ovirt.engine.core.bll.ValidationResult) AuditLogType(org.ovirt.engine.core.common.AuditLogType) Collections(java.util.Collections) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) MultipleDiskVmElementValidator(org.ovirt.engine.core.bll.validator.storage.MultipleDiskVmElementValidator) AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) Guid(org.ovirt.engine.core.compat.Guid) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl) DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk)

Example 70 with AuditLogableImpl

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

the class AsyncTaskManager method cleanZombieTasks.

private void cleanZombieTasks() {
    long maxTime = DateTime.getNow().addMinutes(-1 * Config.<Integer>getValue(ConfigValues.AsyncTaskZombieTaskLifeInMinutes)).getTime();
    for (SPMTask task : tasks.values()) {
        if (task.getParameters().getDbAsyncTask().getStartTime().getTime() < maxTime) {
            AuditLogable logable = new AuditLogableImpl();
            logable.addCustomValue("CommandName", task.getParameters().getDbAsyncTask().getActionType().toString());
            logable.addCustomValue("Date", task.getParameters().getDbAsyncTask().getStartTime().toString());
            // status
            if (task.getLastTaskStatus().getStatus() != AsyncTaskStatusEnum.finished && task.getLastTaskStatus().getStatus() != AsyncTaskStatusEnum.unknown) {
                // mark it as a zombie task, Will result in failure of the command
                task.setZombieTask(true);
                auditLogDirector.log(logable, AuditLogType.TASK_STOPPING_ASYNC_TASK);
                log.info("Cleaning zombie tasks: Stopping async task '{}' that started at '{}'", task.getParameters().getDbAsyncTask().getActionType(), task.getParameters().getDbAsyncTask().getStartTime());
                task.stopTask(true);
            } else {
                auditLogDirector.log(logable, AuditLogType.TASK_CLEARING_ASYNC_TASK);
                log.info("Cleaning zombie tasks: Clearing async task '{}' that started at '{}'", task.getParameters().getDbAsyncTask().getActionType(), task.getParameters().getDbAsyncTask().getStartTime());
                task.clearAsyncTask(true);
            }
        }
    }
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) SPMTask(org.ovirt.engine.core.bll.tasks.interfaces.SPMTask) 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