use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class ResourceManager method setVmUnknown.
/**
* Set vm status to Unknown and save to DB.
*/
public void setVmUnknown(VM vm) {
removeAsyncRunningVm(vm.getId());
internalSetVmStatus(vm.getDynamicData(), VMStatus.Unknown);
// log VM transition to unknown status
AuditLogable logable = new AuditLogableImpl();
logable.setVmId(vm.getId());
logable.setVmName(vm.getName());
auditLogDirector.log(logable, AuditLogType.VM_SET_TO_UNKNOWN_STATUS);
storeVm(vm);
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class SetVdsStatusVDSCommand method executeVdsIdCommand.
@Override
protected void executeVdsIdCommand() {
final SetVdsStatusVDSCommandParameters parameters = getParameters();
if (_vdsManager != null) {
final VDS vds = getVds();
if (vds.getSpmStatus() != VdsSpmStatus.None && parameters.getStatus() != VDSStatus.Up) {
log.info("VDS '{}' is spm and moved from up calling resetIrs.", vds.getName());
// check if this host was spm and reset if do.
getVDSReturnValue().setSucceeded(resourceManager.runVdsCommand(VDSCommandType.ResetIrs, new ResetIrsVDSCommandParameters(vds.getStoragePoolId(), vds.getId())).getSucceeded());
if (!getVDSReturnValue().getSucceeded()) {
if (getParameters().isStopSpmFailureLogged()) {
AuditLogable base = new AuditLogableImpl();
base.setVdsId(vds.getId());
base.setVdsName(vds.getName());
auditLogDirector.log(base, AuditLogType.VDS_STATUS_CHANGE_FAILED_DUE_TO_STOP_SPM_FAILURE);
}
if (parameters.getStatus() == VDSStatus.PreparingForMaintenance) {
// ResetIrs command failed, SPM host status cannot be moved to Preparing For Maintenance
return;
}
}
}
TransactionSupport.executeInNewTransaction(() -> {
_vdsManager.setStatus(parameters.getStatus(), vds);
_vdsManager.updatePartialDynamicData(parameters.getNonOperationalReason(), parameters.getMaintenanceReason());
_vdsManager.updateStatisticsData(vds.getStatisticsData());
return null;
});
} else {
getVDSReturnValue().setSucceeded(false);
}
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class VdsManager method handleVdsRecoveringException.
private void handleVdsRecoveringException(VDSRecoveringException ex) {
if (cachedVds.getStatus() != VDSStatus.Initializing && cachedVds.getStatus() != VDSStatus.NonOperational) {
setStatus(VDSStatus.Initializing, cachedVds);
vdsDynamicDao.updateStatus(cachedVds.getId(), VDSStatus.Initializing);
AuditLogable logable = createAuditLogableForHost(cachedVds);
logable.addCustomValue("ErrorMessage", ex.getMessage());
logable.updateCallStackFromThrowable(ex);
auditLogDirector.log(logable, AuditLogType.VDS_INITIALIZING);
log.warn("Failed to refresh VDS, continuing, vds='{}'({}): {}", cachedVds.getName(), cachedVds.getId(), ex.getMessage());
log.debug("Exception", ex);
final long VDS_RECOVERY_TIMEOUT_IN_MINUTES = Config.<Long>getValue(ConfigValues.VdsRecoveryTimeoutInMinutes);
ScheduledFuture scheduled = executor.schedule(this::handleVdsRecovering, VDS_RECOVERY_TIMEOUT_IN_MINUTES, TimeUnit.MINUTES);
recoveringJobIdMap.put(cachedVds.getId(), scheduled);
}
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class VdsManager method processRefreshCapabilitiesResponse.
public VDSStatus processRefreshCapabilitiesResponse(AtomicBoolean processHardwareCapsNeeded, VDS vds, VDS oldVDS, VDSReturnValue caps) {
if (caps.getSucceeded()) {
// hence warning in case of permissive as well.
if (vds.getSELinuxEnforceMode() == null || vds.getSELinuxEnforceMode().equals(SELinuxMode.DISABLED) || (vds.getClusterSupportsGlusterService() && vds.getSELinuxEnforceMode().equals(SELinuxMode.PERMISSIVE))) {
AuditLogable auditLogable = createAuditLogableForHost(vds);
auditLogable.addCustomValue("Mode", vds.getSELinuxEnforceMode() == null ? "UNKNOWN" : vds.getSELinuxEnforceMode().name());
auditLogDirector.log(auditLogable, AuditLogType.VDS_NO_SELINUX_ENFORCEMENT);
if (vds.getSELinuxEnforceMode() != null) {
log.warn("Host '{}' is running with SELinux in '{}' mode", vds.getName(), vds.getSELinuxEnforceMode());
} else {
log.warn("Host '{}' does not report SELinux enforcement information.", vds.getName());
}
}
VDSStatus returnStatus = vds.getStatus();
NonOperationalReason nonOperationalReason = getHostNetworkTopologyPersister().persistAndEnforceNetworkCompliance(vds);
if (nonOperationalReason != NonOperationalReason.NONE) {
setIsSetNonOperationalExecuted(true);
if (returnStatus != VDSStatus.NonOperational) {
log.debug("monitoring: vds '{}' networks do not match its cluster networks, vds will be moved to NonOperational", vds);
vds.setStatus(VDSStatus.NonOperational);
vds.setNonOperationalReason(nonOperationalReason);
}
}
// We process the software capabilities.
VDSStatus oldStatus = vds.getStatus();
if (oldStatus != VDSStatus.Up) {
// persist to db the host's cpu_flags.
// TODO this needs to be revisited - either all the logic is in-memory or based on db
vdsDynamicDao.updateCpuFlags(vds.getId(), vds.getCpuFlags());
processHostFeaturesReported(vds);
monitoringStrategy.processHardwareCapabilities(vds);
}
monitoringStrategy.processSoftwareCapabilities(vds);
returnStatus = vds.getStatus();
if (returnStatus != oldStatus && returnStatus == VDSStatus.NonOperational) {
setIsSetNonOperationalExecuted(true);
}
processHardwareCapsNeeded.set(monitoringStrategy.processHardwareCapabilitiesNeeded(oldVDS, vds));
return returnStatus;
} else if (caps.getExceptionObject() != null) {
throw caps.getExceptionObject();
} else {
log.error("refreshCapabilities:GetCapabilitiesVDSCommand failed with no exception!");
throw new RuntimeException(caps.getExceptionString());
}
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class VdsManager method createAuditLogableForHost.
private AuditLogable createAuditLogableForHost(VDS vds) {
AuditLogable logable = new AuditLogableImpl();
logable.setVdsId(vds.getId());
logable.setVdsName(vds.getName());
return logable;
}
Aggregations