use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class VdsEventListener method createVmEvent.
private AuditLogable createVmEvent(Guid vmId, AuditLogType logType) {
AuditLogable event = new AuditLogableImpl();
event.setVmName(vmStaticDao.get(vmId).getName());
event.setVmId(vmId);
auditLogDirector.log(event, logType);
return event;
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class VmPoolMonitor method runVmFromPool.
/**
* Run the given VM as stateless.
*/
private boolean runVmFromPool(VmStatic vmToRun, boolean runAsStateless, String poolName) {
log.info("Running VM '{}' as {}", vmToRun.getName(), runAsStateless ? "stateless" : "stateful");
RunVmParams runVmParams = new RunVmParams(vmToRun.getId());
runVmParams.setEntityInfo(new EntityInfo(VdcObjectType.VM, vmToRun.getId()));
runVmParams.setRunAsStateless(runAsStateless);
ActionReturnValue actionReturnValueurnValue = Backend.getInstance().runInternalAction(ActionType.RunVm, runVmParams, ExecutionHandler.createInternalJobContext().withLock(vmPoolHandler.createLock(vmToRun.getId())));
boolean prestartingVmSucceeded = actionReturnValueurnValue.getSucceeded();
if (!prestartingVmSucceeded) {
AuditLogable log = new AuditLogableImpl();
log.addCustomValue("VmPoolName", poolName);
Injector.get(AuditLogDirector.class).log(log, AuditLogType.VM_FAILED_TO_PRESTART_IN_POOL);
}
log.info("Running VM '{}' as {} {}", vmToRun.getName(), runAsStateless ? "stateless" : "stateful", prestartingVmSucceeded ? "succeeded" : "failed");
return prestartingVmSucceeded;
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class AutodefineExternalNetworkCommand method getWarningMessage.
private AuditLogable getWarningMessage(Cluster cluster) {
AuditLogable event = new AuditLogableImpl();
event.setClusterName(cluster.getName());
event.addCustomValue("NetworkName", getNetwork().getName());
return event;
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class SchedulingManager method performHaResevationCheckImpl.
public void performHaResevationCheckImpl() {
log.debug("HA Reservation check timer entered.");
List<Cluster> clusters = clusterDao.getAll();
if (clusters != null) {
HaReservationHandling haReservationHandling = new HaReservationHandling(getPendingResourceManager(), slaValidator);
for (Cluster cluster : clusters) {
if (cluster.supportsHaReservation()) {
List<VDS> returnedFailedHosts = new ArrayList<>();
boolean clusterHaStatus = haReservationHandling.checkHaReservationStatusForCluster(cluster, returnedFailedHosts);
if (!clusterHaStatus) {
// create Alert using returnedFailedHosts
AuditLogable logable = createEventForCluster(cluster);
String failedHostsStr = returnedFailedHosts.stream().map(VDS::getName).collect(Collectors.joining(", "));
logable.addCustomValue("Hosts", failedHostsStr);
auditLogDirector.log(logable, AuditLogType.CLUSTER_ALERT_HA_RESERVATION);
log.info("Cluster '{}' fail to pass HA reservation check.", cluster.getName());
}
boolean clusterHaStatusFromPreviousCycle = clusterId2isHaReservationSafe.getOrDefault(cluster.getId(), true);
// Update the status map with the new status
clusterId2isHaReservationSafe.put(cluster.getId(), clusterHaStatus);
// Create Alert if the status was changed from false to true
if (!clusterHaStatusFromPreviousCycle && clusterHaStatus) {
AuditLogable logable = createEventForCluster(cluster);
auditLogDirector.log(logable, AuditLogType.CLUSTER_ALERT_HA_RESERVATION_DOWN);
}
}
}
}
log.debug("HA Reservation check timer finished.");
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class SchedulingManager method createEventForCluster.
private AuditLogable createEventForCluster(Cluster cluster) {
AuditLogable logable = new AuditLogableImpl();
logable.setClusterName(cluster.getName());
logable.setClusterId(cluster.getId());
return logable;
}
Aggregations