use of org.ovirt.engine.core.common.errors.EngineException in project ovirt-engine by oVirt.
the class CreateAllOvaDisksCommand method copy.
private void copy(DiskImage source, DiskImage destination) {
ActionReturnValue vdcRetValue = runInternalActionWithTasksContext(ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForDisk(source, destination));
if (!vdcRetValue.getSucceeded()) {
throw new EngineException(vdcRetValue.getFault().getError(), "Failed to copy disk!");
}
// TODO: Currently REST-API doesn't support coco for async commands, remove when bug 1199011 fixed
getTaskIdList().addAll(vdcRetValue.getVdsmTaskIdList());
}
use of org.ovirt.engine.core.common.errors.EngineException in project ovirt-engine by oVirt.
the class CreateAllTemplateDisksCommand method addVmTemplateImage.
private void addVmTemplateImage(DiskImage diskImage, Map<Guid, Guid> srcDeviceIdToTargetDeviceIdMapping) {
// The return value of this action is the 'copyImage' task GUID:
Guid targetDiskId = getParameters().getTargetDiskIds()[targetDiskIdIndex++];
ActionReturnValue returnValue = Backend.getInstance().runInternalAction(ActionType.CreateImageTemplate, buildCreateImageTemplateCommandParameters(diskImage, targetDiskId), ExecutionHandler.createDefaultContextForTasks(getContext()));
if (!returnValue.getSucceeded()) {
throw new EngineException(returnValue.getFault().getError(), returnValue.getFault().getMessage());
}
getReturnValue().getVdsmTaskIdList().addAll(returnValue.getInternalVdsmTaskIdList());
DiskImage newImage = returnValue.getActionReturnValue();
srcDeviceIdToTargetDeviceIdMapping.put(diskImage.getId(), newImage.getId());
}
use of org.ovirt.engine.core.common.errors.EngineException in project ovirt-engine by oVirt.
the class StorageHandlingCommandBase method handleDestroyStoragePoolCommand.
protected void handleDestroyStoragePoolCommand() {
try {
runVdsCommand(VDSCommandType.DestroyStoragePool, new IrsBaseVDSCommandParameters(getStoragePool().getId()));
} catch (EngineException e) {
try {
TransactionSupport.executeInNewTransaction(() -> {
runVdsCommand(VDSCommandType.SpmStopOnIrs, new SpmStopOnIrsVDSCommandParameters(getStoragePool().getId()));
return null;
});
} catch (Exception e1) {
log.error("Failed destroy storage pool with id '{}' and after that failed to stop spm: {}", getStoragePoolId(), e1.getMessage());
log.debug("Exception", e1);
}
throw e;
}
}
use of org.ovirt.engine.core.common.errors.EngineException in project ovirt-engine by oVirt.
the class AddStorageServerConnectionCommand method executeCommand.
@Override
protected void executeCommand() {
// If not, just save the connection to the database
if (!Guid.isNullOrEmpty(getParameters().getVdsId())) {
Pair<Boolean, Integer> result = connectHostToStorage();
boolean isValidConnection = result.getFirst();
// Process failure
if (!isValidConnection) {
throw new EngineException(EngineError.forValue(result.getSecond()));
}
}
StorageServerConnections connection = getConnection();
connection.setId(Guid.newGuid().toString());
saveConnection(connection);
getReturnValue().setActionReturnValue(connection.getId());
setSucceeded(true);
}
use of org.ovirt.engine.core.common.errors.EngineException in project ovirt-engine by oVirt.
the class CINDERStorageHelper method activateCinderDomain.
public void activateCinderDomain(Guid storageDomainId, Guid storagePoolId) {
OpenStackVolumeProviderProxy proxy = OpenStackVolumeProviderProxy.getFromStorageDomainId(storageDomainId, providerProxyFactory);
if (proxy == null) {
log.error("Couldn't create an OpenStackVolumeProviderProxy for storage domain ID: {}", storageDomainId);
return;
}
try {
proxy.testConnection();
updateCinderDomainStatus(storageDomainId, storagePoolId, StorageDomainStatus.Active);
} catch (EngineException e) {
AuditLogable loggable = new AuditLogableImpl();
loggable.addCustomValue("CinderException", e.getCause().getCause() != null ? e.getCause().getCause().getMessage() : e.getCause().getMessage());
auditLogDirector.log(loggable, AuditLogType.CINDER_PROVIDER_ERROR);
throw e;
}
}
Aggregations