use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable 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);
}
}
}
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class FenceVdsVDSCommand method alertActionSkippedAlreadyInStatus.
/**
* Alerts when power management stop was skipped because host is already down.
*/
protected void alertActionSkippedAlreadyInStatus() {
AuditLogable auditLogable = new AuditLogableImpl();
auditLogable.addCustomValue("HostName", getTargetVds().getName());
auditLogable.addCustomValue("AgentStatus", getParameters().getAction().getValue());
auditLogable.addCustomValue("Operation", getParameters().getAction().toString());
auditLogDirector.log(auditLogable, AuditLogType.VDS_ALREADY_IN_REQUESTED_STATUS);
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class FenceVdsVDSCommand method alertPowerManagementStatusFailed.
/**
* Alerts if power management status failed.
*
* @param reason
* The reason.
*/
protected void alertPowerManagementStatusFailed(String reason) {
AuditLogable alert = new AuditLogableImpl();
alert.setVdsId(getParameters().getTargetVdsID());
alert.setVdsName(getTargetVds().getName());
alert.addCustomValue("Reason", reason);
auditLogDirector.log(alert, AuditLogType.VDS_ALERT_FENCE_TEST_FAILED);
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class ExternalNetworkManager method deallocateIfExternal.
/**
* Deallocate the vNIC from the external network, if it's attached to a network and the network is indeed an
* external network (otherwise, nothing is done).
*/
public void deallocateIfExternal() {
if (getNetwork() != null && getNetwork().isExternal()) {
Provider<?> provider = providerDao.get(getNetwork().getProvidedBy().getProviderId());
NetworkProviderProxy providerProxy = providerProxyFactory.create(provider);
try {
providerProxy.deallocate(nic);
} catch (EngineException e) {
AuditLogable removePortFailureEvent = new AuditLogableImpl();
removePortFailureEvent.addCustomValue("NicName", nic.getName());
removePortFailureEvent.addCustomValue("NicId", nic.getId().toString());
removePortFailureEvent.addCustomValue("ProviderName", provider.getName());
auditLogDirector.log(removePortFailureEvent, AuditLogType.REMOVE_PORT_FROM_EXTERNAL_PROVIDER_FAILED);
}
}
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class NetworkConfigurator method findNicToSetupManagementNetwork.
private VdsNetworkInterface findNicToSetupManagementNetwork() {
VdsNetworkInterface nic = Entities.entitiesByName(host.getInterfaces()).get(host.getActiveNic());
if (nic == null) {
log.warn("Failed to find a valid interface for the management network of host {}." + " If the interface {} is a bridge, it should be torn-down manually.", host.getName(), host.getActiveNic());
throw new NetworkConfiguratorException(String.format("Interface %s is invalid for management network", host.getActiveNic()));
}
if (managementNetwork.getName().equals(nic.getNetworkName())) {
return null;
}
if (!nicHasValidVlanId(managementNetwork, nic)) {
final AuditLogable event = createEvent();
event.addCustomValue("VlanId", resolveVlanId(nic.getVlanId()));
event.addCustomValue("MgmtVlanId", resolveVlanId(managementNetwork.getVlanId()));
event.addCustomValue("InterfaceName", nic.getName());
auditLogDirector.log(event, AuditLogType.VLAN_ID_MISMATCH_FOR_MANAGEMENT_NETWORK_CONFIGURATION);
throw new NetworkConfiguratorException(MANAGEMENT_NETWORK_CONFIG_ERR);
}
return nic;
}
Aggregations