/** * 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 coco Handle to command coordinator * @param creationInfo The Asyc Task Creation info */ public static SPMAsyncTask construct( CommandCoordinator coco, AsyncTaskCreationInfo creationInfo) { 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(coco, creationInfo.getTaskType(), asyncTaskParams, true); }