20 update_synapse_ready(
synapse_t * synapse,
int action_id)
23 gboolean updates = FALSE;
28 synapse->
ready = TRUE;
29 for (lpc = synapse->
inputs; lpc != NULL; lpc = lpc->next) {
34 if (prereq->
id == action_id) {
35 crm_trace(
"Marking input %d of synapse %d confirmed", action_id, synapse->
id);
40 synapse->
ready = FALSE;
52 update_synapse_confirmed(
synapse_t * synapse,
int action_id)
55 gboolean updates = FALSE;
56 gboolean is_confirmed = TRUE;
62 for (lpc = synapse->
actions; lpc != NULL; lpc = lpc->next) {
67 if (action->
id == action_id) {
68 crm_trace(
"Confirmed: Action %d of Synapse %d", action_id, synapse->
id);
74 crm_trace(
"Synapse %d still not confirmed after action %d", synapse->
id, action_id);
78 if (is_confirmed && synapse->
confirmed == FALSE) {
94 gboolean updates = FALSE;
97 for (lpc = graph->
synapses; lpc != NULL; lpc = lpc->next) {
105 rc = update_synapse_confirmed(synapse, action->
id);
108 rc = update_synapse_ready(synapse, action->
id);
110 updates = updates ||
rc;
114 crm_trace(
"Updated graph with completed action %d", action->
id);
127 crm_trace(
"Checking pre-reqs for synapse %d", synapse->
id);
129 synapse->
ready = TRUE;
130 for (lpc = synapse->
inputs; lpc != NULL; lpc = lpc->next) {
135 crm_trace(
"Input %d for synapse %d not satisfied: not confirmed", prereq->
id, synapse->
id);
136 synapse->
ready = FALSE;
139 crm_trace(
"Input %d for synapse %d not satisfied: failed", prereq->
id, synapse->
id);
140 synapse->
ready = FALSE;
145 for (lpc = synapse->
actions; synapse->
ready && lpc != NULL; lpc = lpc->next) {
156 }
else if(graph_fns->
allowed && graph_fns->
allowed(graph, a) == FALSE) {
157 crm_trace(
"Deferring synapse %d: allowed", synapse->
id);
162 return synapse->
ready;
168 const char *
id = NULL;
172 id =
ID(action->
xml);
177 crm_trace(
"Executing pseudo-event: %s (%d)",
id, action->
id);
178 return graph_fns->
pseudo(graph, action);
181 crm_trace(
"Executing rsc-event: %s (%d)",
id, action->
id);
182 return graph_fns->
rsc(graph, action);
185 const char *task = NULL;
191 crm_trace(
"Executing STONITH-event: %s (%d)",
id, action->
id);
192 return graph_fns->
stonith(graph, action);
195 crm_trace(
"Executing crm-event: %s (%d)",
id, action->
id);
196 return graph_fns->
crmd(graph, action);
199 crm_err(
"Failed on unsupported command type: %s (id=%s)", crm_element_name(action->
xml),
id);
208 CRM_CHECK(synapse != NULL,
return FALSE);
214 for (lpc = synapse->
actions; lpc != NULL; lpc = lpc->next) {
218 gboolean passed = FALSE;
221 passed = initiate_action(graph, action);
222 if (passed == FALSE) {
223 crm_err(
"Failed initiating <%s id=%d> in synapse %d",
224 crm_element_name(action->
xml), action->
id, synapse->
id);
239 int stat_log_level = LOG_DEBUG;
242 const char *status =
"In-progress";
244 if (graph_fns == NULL) {
256 crm_trace(
"Entering graph %d callback", graph->
id);
259 for (lpc = graph->
synapses; lpc != NULL; lpc = lpc->next) {
267 crm_trace(
"Synapse %d: confirmation pending", synapse->
id);
273 for (lpc = graph->
synapses; lpc != NULL; lpc = lpc->next) {
279 }
else if (synapse->
failed) {
288 if (should_fire_synapse(graph, synapse)) {
291 if(fire_synapse(graph, synapse) == FALSE) {
292 crm_err(
"Synapse %d failed to fire", synapse->
id);
293 stat_log_level = LOG_ERR;
311 stat_log_level = LOG_NOTICE;
316 stat_log_level = LOG_WARNING;
318 status =
"Terminated";
320 }
else if (graph->
skipped != 0) {
324 }
else if (graph->
fired == 0) {
329 "Transition %d (Complete=%d, Pending=%d,"
330 " Fired=%d, Skipped=%d, Incomplete=%d, Source=%s): %s",
#define CRM_CHECK(expr, failure_action)
gboolean(* pseudo)(crm_graph_t *graph, crm_action_t *action)
gboolean(* rsc)(crm_graph_t *graph, crm_action_t *action)
gboolean(* allowed)(crm_graph_t *graph, crm_action_t *action)
#define XML_LRM_ATTR_TASK
#define crm_debug(fmt, args...)
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
#define crm_trace(fmt, args...)
#define do_crm_log(level, fmt, args...)
Log a message.
void set_default_graph_functions(void)
Wrappers for and extensions to libxml2.
gboolean(* crmd)(crm_graph_t *graph, crm_action_t *action)
gboolean update_graph(crm_graph_t *graph, crm_action_t *action)
#define crm_err(fmt, args...)
gboolean(* stonith)(crm_graph_t *graph, crm_action_t *action)
int run_graph(crm_graph_t *graph)
crm_graph_functions_t * graph_fns