use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class VdsManager method logChangeStatusToConnecting.
private void logChangeStatusToConnecting() {
long timeoutToFence = calcTimeoutToFence(cachedVds.getVmCount(), cachedVds.getSpmStatus());
String msg;
AuditLogType auditLogType;
if (cachedVds.isPmEnabled()) {
msg = "Host '{}' is not responding. It will stay in Connecting state for a grace period " + "of {} seconds and after that an attempt to fence the host will be issued.";
auditLogType = AuditLogType.VDS_HOST_NOT_RESPONDING_CONNECTING;
log.warn(msg, cachedVds.getName(), TimeUnit.MILLISECONDS.toSeconds(timeoutToFence));
} else {
msg = "Host '{}' is not responding.";
auditLogType = AuditLogType.VDS_HOST_NOT_RESPONDING;
log.warn(msg, cachedVds.getName());
}
AuditLogable logable = createAuditLogableForHost(cachedVds);
logable.addCustomValue("Seconds", Long.toString(TimeUnit.MILLISECONDS.toSeconds(timeoutToFence)));
auditLogDirector.log(logable, auditLogType);
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class PmHealthCheckManager method addAlert.
private void addAlert(VDS host, AuditLogType auditMessage) {
AuditLogable alert = new AuditLogableImpl();
alert.setVdsId(host.getId());
alert.setVdsName(host.getName());
alert.setClusterId(host.getClusterId());
alert.setClusterName(host.getClusterName());
auditLogDirector.log(alert, auditMessage);
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class DisplayNetworkClusterHelperTest method testWarnOnActiveVmPositive.
/**
* Test method for
* {@link org.ovirt.engine.core.bll.network.cluster.helper.DisplayNetworkClusterHelper#warnOnActiveVm()}.
*/
@Test
public void testWarnOnActiveVmPositive() {
testWarnOnActiveVmInner(true);
verify(mockAuditLogDirector).log(auditLogableCaptor.capture(), same(AuditLogType.NETWORK_UPDATE_DISPLAY_FOR_CLUSTER_WITH_ACTIVE_VM));
final AuditLogable actualLoggable = auditLogableCaptor.getValue();
assertEquals(TEST_CLUSTER_NAME, actualLoggable.getClusterName());
assertEquals(TEST_NETWORK_NAME, actualLoggable.getCustomValues().get("networkname"));
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class VdsBrokerCommand method logToAudit.
@Override
protected void logToAudit() {
if (isPolicyResetMessage(getReturnStatus().message)) {
return;
}
AuditLogable logable = new AuditLogableImpl();
logable.setVdsId(vds.getId());
logable.setVdsName(vds.getName());
logable.addCustomValue("CommandName", getCommandName());
logable.addCustomValue("message", getReturnStatus().message);
auditLogDirector.log(logable, AuditLogType.VDS_BROKER_COMMAND_FAILURE);
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class VdsBrokerObjectsBuilder method checkTimeDrift.
public static void checkTimeDrift(VDS vds, Map<String, Object> struct) {
Boolean isHostTimeDriftEnabled = Config.getValue(ConfigValues.EnableHostTimeDrift);
if (isHostTimeDriftEnabled) {
Integer maxTimeDriftAllowed = Config.getValue(ConfigValues.HostTimeDriftInSec);
Date hostDate = assignDatetimeValue(struct, VdsProperties.hostDatetime);
if (hostDate != null) {
Long timeDrift = TimeUnit.MILLISECONDS.toSeconds(Math.abs(hostDate.getTime() - System.currentTimeMillis()));
if (timeDrift > maxTimeDriftAllowed) {
AuditLogable logable = createAuditLogableForHost(vds);
logable.addCustomValue("Actual", timeDrift.toString());
logable.addCustomValue("Max", maxTimeDriftAllowed.toString());
auditLogDirector.log(logable, AuditLogType.VDS_TIME_DRIFT_ALERT);
}
} else {
log.error("Time Drift validation: failed to get Host or Engine time.");
}
}
}
Aggregations