use of org.ovirt.engine.core.common.errors.EngineFault in project ovirt-engine by oVirt.
the class ConnectStorageToVdsCommand method setErrorMessageAtReturn.
private void setErrorMessageAtReturn(Pair<Boolean, Integer> result) {
EngineFault fault = new EngineFault();
fault.setError(result.getSecond());
if (fault.getError() != null) {
fault.setMessage(Backend.getInstance().getVdsErrorsTranslator().translateErrorTextSingle(fault.getError().toString()));
}
getReturnValue().setFault(fault);
}
use of org.ovirt.engine.core.common.errors.EngineFault in project ovirt-engine by oVirt.
the class FCPStorageHelper method runConnectionStorageToDomain.
@Override
protected Pair<Boolean, EngineFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type, LUNs lun, Guid storagePoolId) {
VDSReturnValue returnValue = backend.getResourceManager().runVdsCommand(VDSCommandType.forValue(type), new StorageServerConnectionManagementVDSParameters(vdsId, storagePoolId, StorageType.FCP, Collections.singletonList(getFCPConnection())));
boolean isSuccess = returnValue.getSucceeded();
EngineFault engineFault = null;
if (!isSuccess && returnValue.getVdsError() != null) {
engineFault = new EngineFault();
engineFault.setError(returnValue.getVdsError().getCode());
}
return new Pair<>(isSuccess, engineFault);
}
use of org.ovirt.engine.core.common.errors.EngineFault in project ovirt-engine by oVirt.
the class FileStorageHelper method runConnectionStorageToDomain.
@Override
protected Pair<Boolean, EngineFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type) {
Pair<Boolean, EngineFault> result;
StorageServerConnections connection = storageServerConnectionDao.get(storageDomain.getStorage());
if (connection != null) {
ActionReturnValue returnValue = backend.runInternalAction(ActionType.forValue(type), new StorageServerConnectionParametersBase(connection, vdsId, false));
result = new Pair<>(returnValue.getSucceeded(), returnValue.getFault());
} else {
result = new Pair<>(false, null);
log.warn("Did not connect host '{}' to storage domain '{}' because connection for connectionId '{}' is null.", vdsId, storageDomain.getStorageName(), storageDomain.getStorage());
}
return result;
}
use of org.ovirt.engine.core.common.errors.EngineFault in project ovirt-engine by oVirt.
the class CINDERStorageHelper method registerLibvirtSecrets.
public Pair<Boolean, EngineFault> registerLibvirtSecrets(StorageDomain storageDomain, VDS vds, List<LibvirtSecret> libvirtSecrets) {
VDSReturnValue returnValue;
if (!libvirtSecrets.isEmpty()) {
try {
returnValue = backend.getResourceManager().runVdsCommand(VDSCommandType.RegisterLibvirtSecrets, new RegisterLibvirtSecretsVDSParameters(vds.getId(), libvirtSecrets));
} catch (RuntimeException e) {
log.error("Failed to register libvirt secret for storage domain {} on vds {}. Error: {}", storageDomain.getName(), vds.getName(), e.getMessage());
log.debug("Exception", e);
return new Pair<>(false, null);
}
if (!returnValue.getSucceeded()) {
addMessageToAuditLog(AuditLogType.FAILED_TO_REGISTER_LIBVIRT_SECRET, storageDomain, vds);
log.error("Failed to register libvirt secret for storage domain {} on vds {}.", storageDomain.getName(), vds.getName());
EngineFault engineFault = new EngineFault();
engineFault.setError(returnValue.getVdsError().getCode());
return new Pair<>(false, engineFault);
}
}
return new Pair<>(true, null);
}
use of org.ovirt.engine.core.common.errors.EngineFault in project ovirt-engine by oVirt.
the class RestoreFromSnapshotCommand method performImageVdsmOperation.
@Override
protected boolean performImageVdsmOperation() {
VDSReturnValue vdsReturnValue = null;
try {
Guid storagePoolId = getDiskImage().getStoragePoolId() != null ? getDiskImage().getStoragePoolId() : Guid.Empty;
Guid storageDomainId = getDiskImage().getStorageIds() != null && !getDiskImage().getStorageIds().isEmpty() ? getDiskImage().getStorageIds().get(0) : Guid.Empty;
Guid imageGroupId = getDiskImage().getId() != null ? getDiskImage().getId() : Guid.Empty;
Guid taskId = persistAsyncTaskPlaceHolder(ActionType.RestoreAllSnapshots);
vdsReturnValue = runVdsCommand(VDSCommandType.DestroyImage, postDeleteActionHandler.fixParameters(new DestroyImageVDSCommandParameters(storagePoolId, storageDomainId, imageGroupId, _imagesToDelete, getDiskImage().isWipeAfterDelete(), storageDomainDao.get(storageDomainId).getDiscardAfterDelete(), true)));
if (vdsReturnValue.getSucceeded()) {
getReturnValue().getInternalVdsmTaskIdList().add(createTask(taskId, vdsReturnValue.getCreationInfo(), ActionType.RestoreAllSnapshots, VdcObjectType.Storage, storageDomainId));
}
}// Don't throw an exception when cannot destroy image in the VDSM.
catch (EngineException e) {
// Set fault for parent command RestoreAllSnapshotCommand to use, if decided to fail the command.
getReturnValue().setFault(new EngineFault(e, e.getVdsError().getCode()));
log.info("Image '{}' not exist in Irs", getDiskImage().getImageId());
}
return vdsReturnValue != null ? vdsReturnValue.getSucceeded() : false;
}
Aggregations