Exemplo n.º 1
0
gboolean
te_graph_trigger(gpointer user_data)
{
    enum transition_status graph_rc = -1;

    if (transition_graph == NULL) {
        crm_debug("Nothing to do");
        return TRUE;
    }

    crm_trace("Invoking graph %d in state %s", transition_graph->id, fsa_state2string(fsa_state));

    switch (fsa_state) {
        case S_STARTING:
        case S_PENDING:
        case S_NOT_DC:
        case S_HALT:
        case S_ILLEGAL:
        case S_STOPPING:
        case S_TERMINATE:
            return TRUE;
            break;
        default:
            break;
    }

    if (transition_graph->complete == FALSE) {
        int limit = transition_graph->batch_limit;

        transition_graph->batch_limit = throttle_get_total_job_limit(limit);
        graph_rc = run_graph(transition_graph);
        transition_graph->batch_limit = limit; /* Restore the configured value */

        /* significant overhead... */
        /* print_graph(LOG_DEBUG_3, transition_graph); */

        if (graph_rc == transition_active) {
            crm_trace("Transition not yet complete");
            return TRUE;

        } else if (graph_rc == transition_pending) {
            crm_trace("Transition not yet complete - no actions fired");
            return TRUE;
        }

        if (graph_rc != transition_complete) {
            crm_warn("Transition failed: %s", transition_status(graph_rc));
            print_graph(LOG_NOTICE, transition_graph);
        }
    }

    crm_debug("Transition %d is now complete", transition_graph->id);
    transition_graph->complete = TRUE;
    notify_crmd(transition_graph);

    return TRUE;
}
Exemplo n.º 2
0
static void
process_next_job(void* data)
{
	crm_graph_t *transition = (crm_graph_t *)data;
	enum transition_status graph_rc;

	qb_enter();

	if (!graph_updated) {
		qb_loop_job_add(NULL, QB_LOOP_MED, transition, process_next_job);
		qb_leave();
		return;
	}

	graph_updated = FALSE;
	graph_rc = run_graph(transition);

	qb_log(LOG_DEBUG, "run_graph returned: %s", transition_status(graph_rc));

	if (graph_rc == transition_active || graph_rc == transition_pending) {
		qb_loop_job_add(NULL, QB_LOOP_MED, transition, process_next_job);
		qb_leave();
		return;
	}

	if (graph_rc != transition_complete) {
		qb_log(LOG_ERR, "Transition failed: %s",
		       transition_status(graph_rc));
	}
	destroy_graph(transition);

	// we don't want to free the input xml
	working_set->input = NULL;
	cleanup_alloc_calculations(working_set);
	free(working_set);
	working_set = NULL;

	completed_fn(run_user_data, graph_rc);

	qb_leave();
	return;
}
Exemplo n.º 3
0
gboolean
te_graph_trigger(gpointer user_data)
{
    enum transition_status graph_rc = -1;

    if (transition_graph == NULL) {
        crm_debug("Nothing to do");
        return TRUE;
    }

    crm_debug_2("Invoking graph %d in state %s", transition_graph->id, fsa_state2string(fsa_state));

    switch (fsa_state) {
    case S_STARTING:
    case S_PENDING:
    case S_NOT_DC:
    case S_HALT:
    case S_ILLEGAL:
    case S_STOPPING:
    case S_TERMINATE:
        return TRUE;
        break;
    default:
        break;
    }

    if (transition_graph->complete == FALSE) {
        graph_rc = run_graph(transition_graph);
        print_graph(LOG_DEBUG_3, transition_graph);

        if (graph_rc == transition_active) {
            crm_debug_3("Transition not yet complete");
            return TRUE;

        } else if (graph_rc == transition_pending) {
            crm_debug_3("Transition not yet complete - no actions fired");
            return TRUE;
        }

        if (graph_rc != transition_complete) {
            crm_err("Transition failed: %s", transition_status(graph_rc));
            print_graph(LOG_WARNING, transition_graph);
        }
    }

    crm_info("Transition %d is now complete", transition_graph->id);
    transition_graph->complete = TRUE;
    notify_crmd(transition_graph);

    return TRUE;
}