Search in sources :

Example 1 with SPMTaskGuidBaseVDSCommandParameters

use of org.ovirt.engine.core.common.vdscommands.SPMTaskGuidBaseVDSCommandParameters in project ovirt-engine by oVirt.

the class CoCoAsyncTaskHelper method revertTasks.

public void revertTasks(CommandBase<?> command) {
    if (command.getParameters().getVdsmTaskIds() != null) {
        // list to send to the pollTasks method
        ArrayList<Guid> taskIdAsList = new ArrayList<>();
        for (Guid taskId : command.getParameters().getVdsmTaskIds()) {
            taskIdAsList.add(taskId);
            ArrayList<AsyncTaskStatus> tasksStatuses = asyncTaskManager.get().pollTasks(taskIdAsList);
            // call revert task only if ended successfully
            if (tasksStatuses.get(0).getTaskEndedSuccessfully()) {
                getBackend().getResourceManager().runVdsCommand(VDSCommandType.SPMRevertTask, new SPMTaskGuidBaseVDSCommandParameters(command.getStoragePool().getId(), taskId));
            }
            taskIdAsList.clear();
        }
    }
}
Also used : SPMTaskGuidBaseVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.SPMTaskGuidBaseVDSCommandParameters) AsyncTaskStatus(org.ovirt.engine.core.common.businessentities.AsyncTaskStatus) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

ArrayList (java.util.ArrayList)1 AsyncTaskStatus (org.ovirt.engine.core.common.businessentities.AsyncTaskStatus)1 SPMTaskGuidBaseVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.SPMTaskGuidBaseVDSCommandParameters)1 Guid (org.ovirt.engine.core.compat.Guid)1