Search in sources :

Example 41 with AsyncTaskStatus

use of org.ovirt.engine.core.common.businessentities.AsyncTaskStatus in project ovirt-engine by oVirt.

the class SPMAsyncTask method checkTaskExist.

/**
 * Print log message, Checks if the cachedStatusTask is null, (indicating the task was not found in the SPM).
 * If so returns {@link AsyncTaskStatusEnum#unknown} status, otherwise returns the status as given.<br>
 * <br>
 * @param cachedStatusTask The status from the SPM, or <code>null</code> is the task wasn't found in the SPM.
 * @return - Updated status task
 */
protected AsyncTaskStatus checkTaskExist(AsyncTaskStatus cachedStatusTask) {
    AsyncTaskStatus returnedStatusTask = null;
    // If the cachedStatusTask is null ,that means the task has not been found in the SPM.
    if (cachedStatusTask == null) {
        // Set to running in order to continue polling the task in case SPM hasn't loaded the tasks yet..
        returnedStatusTask = new AsyncTaskStatus(AsyncTaskStatusEnum.unknown);
        log.error("SPMAsyncTask::PollTask: Task '{}' (Parent Command '{}', Parameters Type '{}') " + "was not found in VDSM, will change its status to unknown.", getVdsmTaskId(), getParameters().getDbAsyncTask().getActionType(), getParameters().getClass().getName());
    } else {
        returnedStatusTask = cachedStatusTask;
    }
    return returnedStatusTask;
}
Also used : AsyncTaskStatus(org.ovirt.engine.core.common.businessentities.AsyncTaskStatus)

Aggregations

AsyncTaskStatus (org.ovirt.engine.core.common.businessentities.AsyncTaskStatus)41 Response (javax.ws.rs.core.Response)26 Test (org.junit.Test)15 Template (org.ovirt.engine.api.model.Template)12 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)9 Action (org.ovirt.engine.api.model.Action)7 Disk (org.ovirt.engine.api.model.Disk)7 Guid (org.ovirt.engine.core.compat.Guid)7 StorageDomain (org.ovirt.engine.api.model.StorageDomain)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 CreationStatus (org.ovirt.engine.api.model.CreationStatus)3 Vm (org.ovirt.engine.api.model.Vm)3 Collections (java.util.Collections)2 Collectors (java.util.stream.Collectors)2 Inject (javax.inject.Inject)2 Fault (org.ovirt.engine.api.model.Fault)2 SPMTask (org.ovirt.engine.core.bll.tasks.interfaces.SPMTask)2 SpmStatusResult (org.ovirt.engine.core.common.businessentities.SpmStatusResult)2