Search in sources :

Example 1 with CommandExecutionStatus

use of org.ovirt.engine.core.compat.backendcompat.CommandExecutionStatus in project ovirt-engine by oVirt.

the class ChildCommandsCallbackBase method doPolling.

@Override
public void doPolling(Guid cmdId, List<Guid> childCmdIds) {
    CommandExecutionStatus status = commandCoordinatorUtil.getCommandExecutionStatus(cmdId);
    // only.
    if (status != CommandExecutionStatus.EXECUTED && commandCoordinatorUtil.getCommandStatus(cmdId) == CommandStatus.ACTIVE) {
        return;
    }
    boolean anyFailed = false;
    int completedChildren = 0;
    CommandBase<?> command = getCommand(cmdId);
    for (Guid childCmdId : childCmdIds) {
        CommandBase<?> child = getCommand(childCmdId);
        switch(commandCoordinatorUtil.getCommandStatus(childCmdId)) {
            case NOT_STARTED:
            case ACTIVE:
            case EXECUTION_FAILED:
                logWaitingForChildCommand(child, command);
                return;
            case FAILED:
                if (shouldWaitForEndMethodsCompletion(child, command)) {
                    return;
                }
                anyFailed = true;
                break;
            case ENDED_WITH_FAILURE:
            case UNKNOWN:
                anyFailed = true;
                break;
            case SUCCEEDED:
                if (shouldWaitForEndMethodsCompletion(child, command)) {
                    return;
                }
            default:
                ++completedChildren;
        }
    }
    childCommandsExecutionEnded(command, anyFailed, childCmdIds, status, completedChildren);
}
Also used : CommandExecutionStatus(org.ovirt.engine.core.compat.backendcompat.CommandExecutionStatus) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

Guid (org.ovirt.engine.core.compat.Guid)1 CommandExecutionStatus (org.ovirt.engine.core.compat.backendcompat.CommandExecutionStatus)1