use of org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo in project ovirt-engine by oVirt.
the class UploadImageVDSCommand method executeIrsBrokerCommand.
@Override
protected void executeIrsBrokerCommand() {
setReturnValue(Guid.Empty);
log.info("-- executeIrsBrokerCommand: calling 'uploadImage', parameters:");
log.info("++ srcSpUUID={}", getParameters().getStoragePoolId());
log.info("++ srcSdUUID={}", getParameters().getStorageDomainId());
log.info("++ srcImageGUID={}", getParameters().getImageGroupId());
log.info("++ srcVolUUID={}", getParameters().getImageId());
log.info("++ uploadLocation={}", getParameters().getUploadInfo());
uuidReturn = getIrsProxy().uploadImage(LocationInfoHelper.prepareLocationInfoForVdsCommand(getParameters().getUploadInfo()), getParameters().getStoragePoolId().toString(), getParameters().getStorageDomainId().toString(), getParameters().getImageGroupId().toString(), getParameters().getImageId().toString());
proceedProxyReturnValue();
getVDSReturnValue().setCreationInfo(new AsyncTaskCreationInfo(new Guid(uuidReturn.uuid), AsyncTaskType.copyImage, getParameters().getStoragePoolId()));
}
use of org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo in project ovirt-engine by oVirt.
the class AddVmLeaseVDSCommand method executeIrsBrokerCommand.
@Override
protected void executeIrsBrokerCommand() {
returnValue = getIrsProxy().addVmLease(getParameters().getLeaseId().toString(), getParameters().getStorageDomainId().toString());
proceedProxyReturnValue();
Guid taskID = new Guid(returnValue.getTaskId());
getVDSReturnValue().setCreationInfo(new AsyncTaskCreationInfo(taskID, AsyncTaskType.addVmLease, getParameters().getStoragePoolId()));
}
use of org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo in project ovirt-engine by oVirt.
the class HttpImageTaskVDSCommand method executeHttpMethod.
protected void executeHttpMethod(final T method) {
int responseCode = -1;
VdsManager manager = resourceManager.getVdsManager(getParameters().getVdsId());
final HttpClient httpclient = manager.getVdsProxy().getHttpClient();
try {
FutureTask<Integer> futureTask = new FutureTask(() -> httpclient.executeMethod(method));
Future<Integer> f = ThreadPoolUtil.execute(futureTask);
if (f.get(Config.<Integer>getValue(getConfigValueTimeLimitForOperation()), TimeUnit.MINUTES) == null) {
responseCode = futureTask.get();
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (Exception e) {
log.debug("Exception", e);
throw createNetworkException(e);
}
if (responseCode == getSuccessCode()) {
Guid createdTask = Guid.createGuidFromString(processResponseHeaderValue(getMethod(), "Task-Id", null));
getVDSReturnValue().setCreationInfo(new AsyncTaskCreationInfo(createdTask, getCreatedTaskType(), getParameters().getStoragePoolId()));
handleOkResponse();
getVDSReturnValue().setSucceeded(true);
return;
}
processResponseHeaderValue(getMethod(), "Content-type", "application/json");
String response;
try {
response = getMethod().getResponseBodyAsString();
} catch (Exception e) {
throw createNetworkException(e);
}
Map<String, Object> resultMap = null;
try {
resultMap = new ObjectMapper().readValue(response, HashMap.class);
status = new StatusOnlyReturn(resultMap);
} catch (Exception e) {
throwVdsErrorException("failed to parse response " + response, EngineError.GeneralException);
}
proceedProxyReturnValue();
}
use of org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo in project ovirt-engine by oVirt.
the class MergeSnapshotsVDSCommand method executeIrsBrokerCommand.
@Override
protected void executeIrsBrokerCommand() {
uuidReturn = mergeSnapshots(getParameters().getStorageDomainId().toString(), getParameters().getStoragePoolId().toString(), getParameters().getVmId().toString(), getParameters().getImageGroupId().toString(), getParameters().getImageId().toString(), getParameters().getImageId2().toString(), String.valueOf(getParameters().getPostZero()).toLowerCase(), getParameters().isDiscard());
proceedProxyReturnValue();
Guid taskID = new Guid(uuidReturn.uuid);
getVDSReturnValue().setCreationInfo(new AsyncTaskCreationInfo(taskID, AsyncTaskType.mergeSnapshots, getParameters().getStoragePoolId()));
}
use of org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo in project ovirt-engine by oVirt.
the class PrepareMergeVDSCommand method executeIrsBrokerCommand.
@Override
protected void executeIrsBrokerCommand() {
uuidReturn = getIrsProxy().prepareMerge(getParameters().getStoragePoolId().toString(), SubchainInfoHelper.prepareSubchainInfoForVdsCommand(getParameters().getSubchainInfo()));
proceedProxyReturnValue();
Guid taskID = new Guid(uuidReturn.uuid);
getVDSReturnValue().setCreationInfo(new AsyncTaskCreationInfo(taskID, AsyncTaskType.prepareMerge, getParameters().getStoragePoolId()));
}
Aggregations