use of org.ovirt.engine.core.bll.CommandMultiAsyncTasks in project ovirt-engine by oVirt.
the class CommandAsyncTask method concreteStartPollingTask.
@Override
public void concreteStartPollingTask() {
CommandMultiAsyncTasks entityInfo = getCommandMultiAsyncTasks();
entityInfo.startPollingTask(getVdsmTaskId());
}
use of org.ovirt.engine.core.bll.CommandMultiAsyncTasks in project ovirt-engine by oVirt.
the class CommandAsyncTask method endCommandAction.
private void endCommandAction() {
CommandMultiAsyncTasks entityInfo = getCommandMultiAsyncTasks();
ActionReturnValue actionReturnValue = null;
ExecutionContext context = null;
boolean endActionRuntimeException = false;
AsyncTask dbAsyncTask = getParameters().getDbAsyncTask();
ArrayList<ActionParametersBase> imagesParameters = new ArrayList<>();
for (EndedTaskInfo taskInfo : entityInfo.getEndedTasksInfo().getTasksInfo()) {
ActionParametersBase childTaskParameters = taskInfo.getTaskParameters().getDbAsyncTask().getTaskParameters();
boolean childTaskGroupSuccess = childTaskParameters.getTaskGroupSuccess() && taskInfo.getTaskStatus().getTaskEndedSuccessfully();
childTaskParameters.setTaskGroupSuccess(childTaskGroupSuccess);
if (!childTaskParameters.equals(dbAsyncTask.getActionParameters())) {
imagesParameters.add(childTaskParameters);
}
}
dbAsyncTask.getActionParameters().setImagesParameters(imagesParameters);
try {
log.info("CommandAsyncTask::endCommandAction [within thread] context: Attempting to endAction '{}',", dbAsyncTask.getActionParameters().getCommandType());
try {
actionReturnValue = coco.endAction(this);
} catch (EngineException ex) {
log.error("{}: {}", getErrorMessage(), ex.getMessage());
log.debug("Exception", ex);
} catch (RuntimeException ex) {
log.error(getErrorMessage(), ex);
endActionRuntimeException = true;
}
} catch (RuntimeException Ex2) {
log.error("CommandAsyncTask::endCommandAction [within thread]: An exception has been thrown (not" + " related to 'endAction' itself)", Ex2);
endActionRuntimeException = true;
} finally {
// if a RuntimeExcpetion occurs we clear the task from db and perform no other action
if (endActionRuntimeException) {
handleEndActionRuntimeException(entityInfo, dbAsyncTask);
} else {
boolean isTaskGroupSuccess = dbAsyncTask.getActionParameters().getTaskGroupSuccess();
handleEndActionResult(entityInfo, actionReturnValue, context, isTaskGroupSuccess);
}
}
}
use of org.ovirt.engine.core.bll.CommandMultiAsyncTasks in project ovirt-engine by oVirt.
the class CommandAsyncTask method endActionIfNecessary.
private void endActionIfNecessary() {
CommandMultiAsyncTasks entityInfo = getCommandMultiAsyncTasks();
if (entityInfo == null) {
log.warn("CommandAsyncTask::endActionIfNecessary: No info is available for entity '{}', current" + " task ('{}') was probably created while other tasks were in progress, clearing task.", getCommandId(), getVdsmTaskId());
clearAsyncTask();
} else if (entityInfo.shouldEndAction() && !hasRunningChildCommands()) {
log.info("CommandAsyncTask::endActionIfNecessary: All tasks of command '{}' has ended -> executing 'endAction'", getCommandId());
log.info("CommandAsyncTask::endAction: Ending action for '{}' tasks (command ID: '{}'): calling endAction '.", entityInfo.getTasksCountCurrentActionType(), entityInfo.getCommandId());
entityInfo.markAllWithAttemptingEndAction();
ThreadPoolUtil.execute(() -> endCommandAction());
}
}
Aggregations