use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl in project ovirt-engine by oVirt.
the class StorageHelperBase method addToAuditLogErrorMessage.
protected String addToAuditLogErrorMessage(String connection, String errorCode, List<StorageServerConnections> connections, LUNs lun) {
AuditLogable logable = new AuditLogableImpl();
String connectionField = getConnectionDescription(connections, connection) + (lun == null ? "" : " (LUN " + lun.getLUNId() + ")");
logable.addCustomValue("Connection", connectionField);
// Get translated error by error code ,if no translation found (should not happened) ,
// will set the error code instead.
String translatedError = getTranslatedStorageError(errorCode);
logable.addCustomValue("ErrorMessage", translatedError);
auditLogDirector.log(logable, AuditLogType.STORAGE_DOMAIN_ERROR);
return connectionField;
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl in project ovirt-engine by oVirt.
the class StorageHelperBase method addMessageToAuditLog.
public void addMessageToAuditLog(AuditLogType auditLogType, StorageDomain storageDomain, VDS vds) {
AuditLogable logable = new AuditLogableImpl();
logable.setVdsId(vds.getId());
logable.setVdsName(vds.getName());
if (storageDomain != null) {
logable.setStorageDomainId(storageDomain.getId());
logable.setStorageDomainName(storageDomain.getName());
}
auditLogDirector.log(logable, auditLogType);
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl 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.AuditLogableImpl 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.AuditLogableImpl 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);
}
Aggregations