Search in sources :

Example 1 with CommandCoordinator

use of org.ovirt.engine.core.bll.tasks.interfaces.CommandCoordinator in project ovirt-engine by oVirt.

the class AsyncTaskFactory method construct.

/**
 * Constructs a task based on creation info (task type and task parameters
 * as retrieved from the vdsm). Use in order to construct tasks when service
 * is initializing.
 * @param creationInfo
 *          The Asyc Task Creation info
 */
public SPMAsyncTask construct(AsyncTaskCreationInfo creationInfo) {
    CommandCoordinator coco = cocoInstance.get();
    AsyncTask asyncTask = coco.getByVdsmTaskId(creationInfo.getVdsmTaskId());
    if (asyncTask == null || asyncTask.getActionParameters() == null) {
        asyncTask = new AsyncTask(AsyncTaskResultEnum.success, AsyncTaskStatusEnum.running, Guid.Empty, creationInfo.getVdsmTaskId(), creationInfo.getStepId(), creationInfo.getStoragePoolID(), creationInfo.getTaskType(), getCommandEntity(coco, asyncTask == null ? Guid.newGuid() : asyncTask.getRootCommandId()), getCommandEntity(coco, asyncTask == null ? Guid.newGuid() : asyncTask.getCommandId()));
        creationInfo.setTaskType(AsyncTaskType.unknown);
    }
    AsyncTaskParameters asyncTaskParams = new AsyncTaskParameters(creationInfo, asyncTask);
    return construct(creationInfo.getTaskType(), asyncTaskParams, true);
}
Also used : CommandCoordinator(org.ovirt.engine.core.bll.tasks.interfaces.CommandCoordinator) AsyncTask(org.ovirt.engine.core.common.businessentities.AsyncTask) AsyncTaskParameters(org.ovirt.engine.core.common.asynctasks.AsyncTaskParameters)

Aggregations

CommandCoordinator (org.ovirt.engine.core.bll.tasks.interfaces.CommandCoordinator)1 AsyncTaskParameters (org.ovirt.engine.core.common.asynctasks.AsyncTaskParameters)1 AsyncTask (org.ovirt.engine.core.common.businessentities.AsyncTask)1