12 #include <sys/param.h>
33 if (pe_rsc_is_clone(action->
rsc) && node) {
60 convert_non_atomic_uuid(
char *old_uuid,
resource_t * rsc, gboolean allow_notify,
61 gboolean free_original)
63 guint interval_ms = 0;
66 char *raw_task = NULL;
71 if (old_uuid == NULL) {
74 }
else if (strstr(old_uuid,
"notify") != NULL) {
82 if (interval_ms > 0) {
107 crm_err(
"Unknown action: %s", raw_task);
119 pe_rsc_trace(rsc,
"Converted %s -> %s", old_uuid, uuid);
124 uuid = strdup(old_uuid);
137 rsc_expand_action(
action_t * action)
139 gboolean notify = FALSE;
159 uuid = convert_non_atomic_uuid(action->
uuid, rsc, notify, FALSE);
164 if (result == NULL) {
165 crm_err(
"Couldn't expand %s to %s in %s", action->
uuid, uuid, rsc->
id);
181 gboolean processed = FALSE;
229 first_flags, restart,
257 crm_trace(
"implies left: %s (%d) then %s (%d)",
273 "implies left when right rsc is Master role: %s then %s: changed",
276 crm_trace(
"implies left when right rsc is Master role: %s then %s", first->
uuid,
313 pe_rsc_trace(then->
rsc,
"Ignoring %s then %s - %s is about to be stopped",
442 if (processed == FALSE) {
456 for (; gIter != NULL; gIter = gIter->next) {
495 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
503 for (gIter = rsc->
rsc_cons_lhs; gIter != NULL; gIter = gIter->next) {
506 mark_start_blocked(colocate_with->
rsc_lh, action->
rsc, data_set);
516 int last_flags = then->
flags;
561 crm_trace(
"First: Found node %s for %s", first_node->details->uname, first->
uuid);
568 crm_trace(
"Then: Found node %s for %s", then_node->details->uname, then->
uuid);
573 && (first_node->details != then_node->details)) {
575 crm_trace(
"Disabled constraint %s on %s -> %s on %s",
576 other->
action->
uuid, first_node->details->uname,
577 then->
uuid, then_node->details->uname);
595 if (first->
rsc && then->
rsc && (first->
rsc != then->
rsc)
597 first = rsc_expand_action(first);
599 if (first != other->
action) {
604 first_flags = get_action_flags(first, then_node);
605 then_flags = get_action_flags(then, first_node);
607 crm_trace(
"Checking %s (%s %s %s) against %s (%s %s %s) filter=0x%.6x type=0x%.6x",
613 uname :
"", first->
uuid, is_set(first_flags,
620 if (first == other->
action) {
635 changed |= graph_update_action(first, then, node, first_flags,
636 then_flags, other, data_set);
649 crm_trace(
"Disabled constraint %s -> %s in favor of %s -> %s",
658 crm_trace(
"Updated %s (first %s %s %s), processing dependents ",
665 for (lpc2 = first->
actions_after; lpc2 != NULL; lpc2 = lpc2->next) {
675 if (last_flags != then->
flags) {
683 crm_trace(
"Updated %s (then %s %s %s), processing dependents ",
695 for (lpc = then->
actions_after; lpc != NULL; lpc = lpc->next) {
713 for (lpc = data_set->
actions; lpc != NULL; lpc = lpc->next) {
716 if (action->
rsc == NULL || action->
node == NULL) {
724 pe_rsc_trace(action->
rsc,
"Skipping %s: node %s is in maintenance mode",
766 CRM_CHECK(stonith_op != NULL,
return FALSE);
767 for (r = data_set->
resources; r != NULL; r = r->next) {
778 node_t *router_node = NULL;
779 bool partial_migration = FALSE;
780 const char *task = action->
task;
794 partial_migration = TRUE;
799 if (!began_on || !ended_on) {
801 return began_on ? began_on : ended_on;
830 task = g_hash_table_lookup(action->
meta,
"notify_operation");
837 safe_str_eq(task,
"migrate_to")) && !partial_migration) {
839 router_node = began_on;
843 router_node = ended_on;
856 add_node_to_xml_by_id(
const char *
id, xmlNode *xml)
874 add_node_to_xml(
const node_t *node,
void *xml)
876 add_node_to_xml_by_id(node->
details->
id, (xmlNode *) xml);
890 xmlNode *maintenance =
894 for (gIter = data_set->
nodes; gIter != NULL;
895 gIter = gIter->next) {
903 if (details->maintenance != details->remote_maintenance) {
906 add_node_to_xml_by_id(node->
details->
id, maintenance),
912 crm_trace(
"%s %d nodes to adjust maintenance-mode "
913 "to transition", maintenance?
"Added":
"Counted", count);
928 if (add_maintenance_nodes(NULL, data_set)) {
929 crm_trace(
"adding maintenance state update pseudo action");
948 add_downed_nodes(xmlNode *xml,
const action_t *action,
951 CRM_CHECK(xml && action && action->
node && data_set,
return);
962 const char *fence = g_hash_table_lookup(action->
meta,
"stonith_action");
978 gboolean migrating = FALSE;
980 for (iter = action->
actions_before; iter != NULL; iter = iter->next) {
990 add_node_to_xml_by_id(action->
rsc->
id, downed);
998 gboolean needs_node_info = TRUE;
999 gboolean needs_maintenance_info = FALSE;
1000 xmlNode *action_xml = NULL;
1001 xmlNode *args_xml = NULL;
1002 #if ENABLE_VERSIONED_ATTRS
1003 pe_rsc_action_details_t *rsc_details = NULL;
1006 if (action == NULL) {
1031 needs_maintenance_info = TRUE;
1034 needs_node_info = FALSE;
1038 #if ENABLE_VERSIONED_ATTRS
1039 rsc_details = pe_rsc_action_details(action);
1046 char *clone_key = NULL;
1047 const char *interval_ms_s = g_hash_table_lookup(action->
meta,
1052 const char *n_type = g_hash_table_lookup(action->
meta,
"notify_type");
1053 const char *n_task = g_hash_table_lookup(action->
meta,
"notify_operation");
1057 crm_err(
"No notify operation value found for %s", action->
uuid));
1065 action->
task, interval_ms);
1077 if (needs_node_info && action->
node != NULL) {
1078 node_t *router_node = get_router_node(action);
1102 const char *attr_list[] = {
1120 crm_debug(
"Using orphan clone name %s instead of %s", action->
rsc->
id,
1126 const char *xml_id =
ID(action->
rsc->
xml);
1128 crm_debug(
"Using anonymous clone name %s for %s (aka. %s)", xml_id, action->
rsc->
id,
1156 for (lpc = 0; lpc <
DIMOF(attr_list); lpc++) {
1158 g_hash_table_lookup(action->
rsc->
meta, attr_list[lpc]));
1168 if (action->
rsc != NULL && action->
node) {
1169 GHashTable *p = crm_str_table_new();
1173 g_hash_table_destroy(p);
1175 #if ENABLE_VERSIONED_ATTRS
1179 pe_get_versioned_attributes(versioned_parameters, action->
rsc,
1180 action->
node, data_set);
1191 #if ENABLE_VERSIONED_ATTRS
1198 #if ENABLE_VERSIONED_ATTRS
1201 add_node_copy(action_xml, rsc_details->versioned_parameters);
1211 if (action->
rsc != NULL) {
1212 const char *value = g_hash_table_lookup(action->
rsc->
meta,
"external-ip");
1215 while (parent != NULL) {
1221 hash2smartfield((gpointer)
"pcmk_external_ip", (gpointer)value, (gpointer)args_xml);
1229 const char *n_task = g_hash_table_lookup(action->
meta,
"notify_operation");
1273 if (needs_node_info && (action->
node != NULL)) {
1274 add_downed_nodes(action_xml, action, data_set);
1277 if (needs_maintenance_info) {
1278 add_maintenance_nodes(action_xml, data_set);
1288 CRM_CHECK(action != NULL,
return false);
1313 for (lpc = action->
actions_after; lpc != NULL; lpc = lpc->next) {
1321 || should_dump_action(wrapper->
action)) {
1322 crm_trace(
"Action %s (%d) should be dumped: "
1323 "dependency of %s (%d)",
1324 action->
uuid, action->
id,
1332 crm_trace(
"Ignoring action %s (%d): unrunnable",
1333 action->
uuid, action->
id);
1338 crm_trace(
"Ignoring action %s (%d): optional",
1339 action->
uuid, action->
id);
1346 const char *interval_ms_s = g_hash_table_lookup(action->
meta,
1350 if ((interval_ms_s == NULL) || !strcmp(interval_ms_s,
"0")) {
1351 crm_trace(
"Ignoring action %s (%d): for unmanaged resource (%s)",
1364 if (action->
node == NULL) {
1365 pe_err(
"Skipping action %s (%d) "
1366 "because it was not allocated to a node (bug?)",
1367 action->
uuid, action->
id);
1368 log_action(LOG_DEBUG,
"Unallocated action", action,
false);
1373 crm_trace(
"Action %s (%d) should be dumped: "
1374 "assuming will be runnable on guest node %s",
1378 pe_err(
"Skipping action %s (%d) "
1379 "because it was scheduled for offline node (bug?)",
1380 action->
uuid, action->
id);
1381 log_action(LOG_DEBUG,
"Action for offline node", action, FALSE);
1388 pe_err(
"Skipping action %s (%d) "
1389 "because it was scheduled for unclean node (bug?)",
1390 action->
uuid, action->
id);
1391 log_action(LOG_DEBUG,
"Action for unclean node", action,
false);
1400 sort_action_id(gconstpointer a, gconstpointer b)
1447 crm_trace(
"Ignoring %s (%d) input %s (%d): "
1448 "ordering disabled",
1449 action->
uuid, action->
id,
1456 crm_trace(
"Ignoring %s (%d) input %s (%d): "
1457 "optional and input unrunnable",
1458 action->
uuid, action->
id,
1464 crm_trace(
"Ignoring %s (%d) input %s (%d): "
1465 "one-or-more and input unrunnable",
1466 action->
uuid, action->
id,
1472 crm_trace(
"Ignoring %s (%d) input %s (%d): "
1473 "stonith stop but action is pseudo",
1474 action->
uuid, action->
id,
1480 crm_trace(
"Ignoring %s (%d) input %s (%d): "
1481 "implies input migratable but input unrunnable",
1482 action->
uuid, action->
id,
1488 crm_trace(
"Ignoring %s (%d) input %s (%d): "
1489 "only if input unmigratable but input unrunnable",
1490 action->
uuid, action->
id,
1497 crm_trace(
"Ignoring %s (%d) input %s (%d): "
1498 "optional but stop in migration",
1499 action->
uuid, action->
id,
1514 if ((input_node == NULL) || (allocated == NULL)
1516 crm_trace(
"Ignoring %s (%d) input %s (%d): "
1517 "load ordering node mismatch %s vs %s",
1518 action->
uuid, action->
id,
1526 }
else if ((input_node == NULL) || (action->
node == NULL)
1528 crm_trace(
"Ignoring %s (%d) input %s (%d): "
1529 "load ordering node mismatch %s vs %s",
1530 action->
uuid, action->
id,
1538 crm_trace(
"Ignoring %s (%d) input %s (%d): "
1539 "load ordering input optional",
1540 action->
uuid, action->
id,
1549 crm_trace(
"Ignoring %s (%d) input %s (%d): "
1550 "anti-colocation node mismatch %s vs %s",
1551 action->
uuid, action->
id,
1559 crm_trace(
"Ignoring %s (%d) input %s (%d): "
1560 "anti-colocation input optional",
1561 action->
uuid, action->
id,
1572 && action->
rsc && pe_rsc_is_clone(action->
rsc)) {
1573 crm_warn(
"Ignoring requirement that %s complete before %s:"
1574 " unmanaged failed resources cannot prevent clone shutdown",
1581 && !should_dump_action(input->
action)) {
1582 crm_trace(
"Ignoring %s (%d) input %s (%d): "
1584 action->
uuid, action->
id,
1589 crm_trace(
"%s (%d) input %s (%d) @ %s should be dumped: %s, %s, %s, 0x%.6x",
1590 action->
uuid, action->
id,
1604 bool has_loop =
false;
1607 crm_trace(
"Breaking tracking loop: %s@%s -> %s@%s (0x%.6x)",
1617 if (!check_dump_input(action, input)) {
1621 if (input->
action == init_action) {
1622 crm_debug(
"Input loop found in %s@%s ->...-> %s@%s",
1632 crm_trace(
"Checking inputs of action %s@%s input %s@%s (0x%.6x)"
1633 "for graph loop with %s@%s ",
1644 iter != NULL; iter = iter->next) {
1646 if (graph_has_loop(init_action, input->
action,
1658 crm_trace(
"No input loop found in %s@%s -> %s@%s (0x%.6x)",
1679 crm_warn(
"Invalid ordering constraint between %s and %s",
1693 && graph_has_loop(action, action, input)) {
1715 crm_trace(
"Input %s (%d) duplicate skipped for action %s (%d)",
1717 action->
uuid, action->
id);
1757 int synapse_priority = 0;
1758 xmlNode *syn = NULL;
1759 xmlNode *set = NULL;
1761 xmlNode *xml_action = NULL;
1768 deduplicate_inputs(action);
1772 if (should_dump_action(action) == FALSE) {
1785 if (action->
rsc != NULL) {
1788 if (action->
priority > synapse_priority) {
1789 synapse_priority = action->
priority;
1791 if (synapse_priority > 0) {
1795 xml_action = action2xml(action, FALSE, data_set);
1798 for (lpc = action->
actions_before; lpc != NULL; lpc = lpc->next) {
1800 if (check_dump_input(action, input)) {
1804 xml_action = action2xml(input->
action, TRUE, data_set);