use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class StorageHandlingCommandBase method getEntitiesFromStorageOvfDisk.
protected List<OvfEntityData> getEntitiesFromStorageOvfDisk(Guid storageDomainId, Guid storagePoolId) {
// Initialize a new ArrayList with all the ovfDisks in the specified Storage Domain,
// so the entities can be removed from the list every time we register the latest OVF disk and we can keep the
// ovfDisks cache list updated.
List<DiskImage> ovfStoreDiskImages = new ArrayList<>(getAllOVFDisks(storageDomainId, storagePoolId));
if (!ovfStoreDiskImages.isEmpty()) {
while (!ovfStoreDiskImages.isEmpty()) {
Pair<DiskImage, Long> ovfDiskAndSize = getLatestOVFDisk(ovfStoreDiskImages);
DiskImage ovfDisk = ovfDiskAndSize.getFirst();
if (ovfDisk != null) {
try {
ActionReturnValue actionReturnValueReturnValue = runInternalAction(ActionType.RetrieveImageData, new RetrieveImageDataParameters(getParameters().getStoragePoolId(), storageDomainId, ovfDisk.getId(), ovfDisk.getImage().getId(), ovfDiskAndSize.getSecond()), cloneContextAndDetachFromParent());
getReturnValue().getVdsmTaskIdList().addAll(actionReturnValueReturnValue.getInternalVdsmTaskIdList());
if (actionReturnValueReturnValue.getSucceeded()) {
List<OvfEntityData> returnedMap = ovfUtils.getOvfEntities(actionReturnValueReturnValue.getActionReturnValue(), unregisteredDisks, storageDomainId);
return returnedMap;
} else {
log.error("Image data could not be retrieved for disk id '{}' in storage domain id '{}'", ovfDisk.getId(), storageDomainId);
}
} catch (RuntimeException e) {
// We are catching RuntimeException, since the call for OvfUtils.getOvfEntities will throw
// a RuntimeException if there is a problem to untar the file.
log.error("Image data could not be retrieved for disk id '{}' in storage domain id '{}': {}", ovfDisk.getId(), storageDomainId, e.getMessage());
log.debug("Exception", e);
}
ovfStoreDiskImages.remove(ovfDisk);
} else {
log.error("Couldn't find additional ovf store to retrieve the ovf data from in storage domain '{}'", storageDomainId);
break;
}
}
AuditLogable logable = new AuditLogableImpl();
logable.setStorageDomainId(storageDomainId);
logable.setStorageDomainName(storageDomainStaticDao.get(storageDomainId).getName());
auditLogDirector.log(logable, AuditLogType.RETRIEVE_OVF_STORE_FAILED);
} else {
log.warn("There are no OVF_STORE disks on storage domain id {}", storageDomainId);
}
return new ArrayList<>();
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class VdsDeploy method userVisibleLog.
@Override
public void userVisibleLog(Level level, String message) {
if (!_alertLog) {
super.userVisibleLog(level, message);
} else {
AuditLogType type = _levelToType.get(level);
if (type == null) {
log.debug(message);
} else {
AuditLogable logable = new AuditLogableImpl();
logable.setVdsId(getVds().getId());
logable.setVdsName(getVds().getName());
logable.setClusterId(getVds().getClusterId());
logable.setClusterName(getVds().getClusterName());
logable.setCorrelationId(getCorrelationId());
logable.addCustomValue("Message", message);
Injector.get(AuditLogDirector.class).log(logable, _levelToType.get(level));
}
}
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class SyncMacsOfDbNicsWithSnapshot method auditLogPerformedReplacements.
private void auditLogPerformedReplacements(List<Pair<String, String>> macReplacements) {
AuditLogable event = new AuditLogableImpl();
List<String> replacementsString = macReplacements.stream().map(e -> e.getFirst() + "->" + e.getSecond()).collect(Collectors.toList());
String auditLogMessage = "Following MACs had to be reallocated: " + replacementsString;
auditLogDirector.log(event, AuditLogType.MAC_ADDRESS_HAD_TO_BE_REALLOCATED, auditLogMessage);
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class VdsManager method moveVmsToUnknown.
private void moveVmsToUnknown(List<VmDynamic> vms) {
if (vms.isEmpty()) {
return;
}
List<Guid> vmIds = vms.stream().map(VmDynamic::getId).collect(Collectors.toList());
vmIds.forEach(resourceManager::removeAsyncRunningVm);
getVmDynamicDao().updateVmsToUnknown(vmIds);
vmIds.forEach(vmId -> {
// log VM transition to unknown status
AuditLogable logable = new AuditLogableImpl();
logable.setVmId(vmId);
logable.setVmName(vmStaticDao.get(vmId).getName());
auditLogDirector.log(logable, AuditLogType.VM_SET_TO_UNKNOWN_STATUS);
});
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable in project ovirt-engine by oVirt.
the class VdsManager method logHostFailToRespond.
private void logHostFailToRespond(VDSNetworkException ex) {
long timeoutToFence = calcTimeoutToFence(cachedVds.getVmCount(), cachedVds.getSpmStatus());
log.info("Server failed to respond, vds_id='{}', vds_name='{}', vm_count={}, " + "spm_status='{}', non-responsive_timeout (seconds)={}, error: {}", cachedVds.getId(), cachedVds.getName(), cachedVds.getVmCount(), cachedVds.getSpmStatus(), TimeUnit.MILLISECONDS.toSeconds(timeoutToFence), ex.getMessage());
AuditLogable logable = createAuditLogableForHost(cachedVds);
logable.updateCallStackFromThrowable(ex);
if (ex.getCause() instanceof java.net.UnknownHostException) {
auditLogDirector.log(logable, AuditLogType.VDS_UNKNOWN_HOST);
} else {
auditLogDirector.log(logable, AuditLogType.VDS_FAILURE);
}
}
Aggregations