31 update_synapse_ready(
synapse_t * synapse,
int action_id)
34 gboolean updates = FALSE;
39 synapse->
ready = TRUE;
40 for (lpc = synapse->
inputs; lpc != NULL; lpc = lpc->next) {
45 if (prereq->
id == action_id) {
46 crm_trace(
"Marking input %d of synapse %d confirmed", action_id, synapse->
id);
51 synapse->
ready = FALSE;
63 update_synapse_confirmed(
synapse_t * synapse,
int action_id)
66 gboolean updates = FALSE;
67 gboolean is_confirmed = TRUE;
73 for (lpc = synapse->
actions; lpc != NULL; lpc = lpc->next) {
78 if (action->
id == action_id) {
79 crm_trace(
"Confirmed: Action %d of Synapse %d", action_id, synapse->
id);
85 crm_trace(
"Synapse %d still not confirmed after action %d", synapse->
id, action_id);
89 if (is_confirmed && synapse->
confirmed == FALSE) {
105 gboolean updates = FALSE;
108 for (lpc = graph->
synapses; lpc != NULL; lpc = lpc->next) {
116 rc = update_synapse_confirmed(synapse, action->
id);
119 rc = update_synapse_ready(synapse, action->
id);
121 updates = updates || rc;
125 crm_trace(
"Updated graph with completed action %d", action->
id);
138 crm_trace(
"Checking pre-reqs for synapse %d", synapse->
id);
140 synapse->
ready = TRUE;
141 for (lpc = synapse->
inputs; lpc != NULL; lpc = lpc->next) {
146 crm_trace(
"Input %d for synapse %d not satisfied: not confirmed", prereq->
id, synapse->
id);
147 synapse->
ready = FALSE;
150 crm_trace(
"Input %d for synapse %d not satisfied: failed", prereq->
id, synapse->
id);
151 synapse->
ready = FALSE;
156 for (lpc = synapse->
actions; synapse->
ready && lpc != NULL; lpc = lpc->next) {
167 }
else if(graph_fns->
allowed && graph_fns->
allowed(graph, a) == FALSE) {
168 crm_trace(
"Deferring synapse %d: allowed", synapse->
id);
173 return synapse->
ready;
179 const char *
id = NULL;
183 id =
ID(action->
xml);
188 crm_trace(
"Executing pseudo-event: %s (%d)",
id, action->
id);
189 return graph_fns->
pseudo(graph, action);
192 crm_trace(
"Executing rsc-event: %s (%d)",
id, action->
id);
193 return graph_fns->
rsc(graph, action);
196 const char *task = NULL;
202 crm_trace(
"Executing STONITH-event: %s (%d)",
id, action->
id);
203 return graph_fns->
stonith(graph, action);
206 crm_trace(
"Executing crm-event: %s (%d)",
id, action->
id);
207 return graph_fns->
crmd(graph, action);
210 crm_err(
"Failed on unsupported command type: %s (id=%s)", crm_element_name(action->
xml),
id);
219 CRM_CHECK(synapse != NULL,
return FALSE);
225 for (lpc = synapse->
actions; lpc != NULL; lpc = lpc->next) {
229 gboolean passed = FALSE;
232 passed = initiate_action(graph, action);
233 if (passed == FALSE) {
234 crm_err(
"Failed initiating <%s id=%d> in synapse %d",
235 crm_element_name(action->
xml), action->
id, synapse->
id);
250 int stat_log_level = LOG_DEBUG;
253 const char *status =
"In-progress";
255 if (graph_fns == NULL) {
267 crm_trace(
"Entering graph %d callback", graph->
id);
270 for (lpc = graph->
synapses; lpc != NULL; lpc = lpc->next) {
278 crm_trace(
"Synapse %d: confirmation pending", synapse->
id);
284 for (lpc = graph->
synapses; lpc != NULL; lpc = lpc->next) {
290 }
else if (synapse->
failed) {
299 if (should_fire_synapse(graph, synapse)) {
302 if(fire_synapse(graph, synapse) == FALSE) {
303 crm_err(
"Synapse %d failed to fire", synapse->
id);
304 stat_log_level = LOG_ERR;
322 stat_log_level = LOG_NOTICE;
327 stat_log_level = LOG_WARNING;
329 status =
"Terminated";
331 }
else if (graph->
skipped != 0) {
335 }
else if (graph->
fired == 0) {
340 "Transition %d (Complete=%d, Pending=%d,"
341 " 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...)
void set_default_graph_functions(void)
#define crm_trace(fmt, args...)
#define do_crm_log(level, fmt, args...)
Log a message.
Wrappers for and extensions to libxml2.
const char * crm_element_value(xmlNode *data, const char *name)
gboolean(* crmd)(crm_graph_t *graph, crm_action_t *action)
gboolean update_graph(crm_graph_t *graph, crm_action_t *action)
crm_graph_functions_t * graph_fns
#define crm_err(fmt, args...)
gboolean(* stonith)(crm_graph_t *graph, crm_action_t *action)
int run_graph(crm_graph_t *graph)
#define safe_str_eq(a, b)