12 #include <sys/param.h> 33 if (pe_rsc_is_clone(
action->rsc) && node) {
61 convert_non_atomic_uuid(
char *old_uuid,
pe_resource_t * rsc, gboolean allow_notify,
62 gboolean free_original)
64 guint interval_ms = 0;
67 char *raw_task = NULL;
72 if (old_uuid == NULL) {
75 }
else if (strstr(old_uuid,
"notify") != NULL) {
83 if (interval_ms > 0) {
108 crm_err(
"Unknown action: %s", raw_task);
120 pe_rsc_trace(rsc,
"Converted %s -> %s", old_uuid, uuid);
125 uuid = strdup(old_uuid);
140 gboolean notify = FALSE;
160 uuid = convert_non_atomic_uuid(
action->uuid, rsc, notify, FALSE);
165 if (result == NULL) {
166 crm_err(
"Couldn't expand %s to %s in %s",
action->uuid, uuid, rsc->
id);
182 gboolean processed = FALSE;
231 first_flags, restart,
260 crm_trace(
"implies left: %s (%d) then %s (%d)",
276 "implies left when right resource is promoted: " 277 "%s then %s: changed", first->
uuid, then->
uuid);
279 crm_trace(
"implies left when right resource is promoted: " 280 "%s then %s", first->
uuid, then->
uuid);
319 pe_rsc_trace(then->
rsc,
"Ignoring %s then %s - %s is about to be stopped",
453 if (processed == FALSE) {
467 for (; gIter != NULL; gIter = gIter->next) {
509 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
517 for (gIter = rsc->
rsc_cons_lhs; gIter != NULL; gIter = gIter->next) {
521 mark_start_blocked(colocate_with->
rsc_lh,
action->rsc, data_set);
531 int last_flags = then->
flags;
576 crm_trace(
"First: Found node %s for %s", first_node->details->uname, first->
uuid);
583 crm_trace(
"Then: Found node %s for %s", then_node->details->uname, then->
uuid);
588 && (first_node != NULL) && (then_node != NULL)
589 && (first_node->details != then_node->details)) {
591 crm_trace(
"Disabled constraint %s on %s -> %s on %s",
592 other->
action->
uuid, first_node->details->uname,
593 then->
uuid, then_node->details->uname);
612 if (first->
rsc && then->
rsc && (first->
rsc != then->
rsc)
614 first = rsc_expand_action(first);
616 if (first != other->
action) {
621 first_flags = get_action_flags(first, then_node);
622 then_flags = get_action_flags(then, first_node);
624 crm_trace(
"Checking %s (%s %s %s) against %s (%s %s %s) filter=0x%.6x type=0x%.6x",
635 first_flags, other->
type);
637 if (first == other->
action) {
652 changed |= graph_update_action(first, then, node, first_flags,
653 then_flags, other, data_set);
667 crm_trace(
"Disabled constraint %s -> %s in favor of %s -> %s",
676 crm_trace(
"Updated %s (first %s %s %s), processing dependents ",
682 for (lpc2 = first->
actions_after; lpc2 != NULL; lpc2 = lpc2->next) {
692 if (last_flags != then->
flags) {
700 crm_trace(
"Updated %s (then %s %s %s), processing dependents ",
712 for (lpc = then->
actions_after; lpc != NULL; lpc = lpc->next) {
730 for (lpc = data_set->
actions; lpc != NULL; lpc = lpc->next) {
746 }
else if (!pcmk_any_flags_set(
action->rsc->flags,
780 CRM_CHECK(stonith_op && data_set,
return);
781 for (GList *r = data_set->
resources; r != NULL; r = r->next) {
791 bool partial_migration = FALSE;
792 const char *task =
action->task;
801 began_on = pe__current_node(
action->node->details->remote_rsc);
802 ended_on =
action->node->details->remote_rsc->allocated_to;
803 if (
action->node->details->remote_rsc
804 && (
action->node->details->remote_rsc->container == NULL)
805 &&
action->node->details->remote_rsc->partial_migration_target) {
806 partial_migration = TRUE;
809 if (began_on == NULL) {
810 crm_trace(
"Routing %s for %s through remote connection's " 811 "next node %s (starting)%s",
814 partial_migration?
" (partial migration)" :
"");
818 if (ended_on == NULL) {
819 crm_trace(
"Routing %s for %s through remote connection's " 820 "current node %s (stopping)%s",
823 partial_migration?
" (partial migration)" :
"");
828 crm_trace(
"Routing %s for %s through remote connection's " 829 "current node %s (not moving)%s",
832 partial_migration?
" (partial migration)" :
"");
844 task = g_hash_table_lookup(
action->meta,
"notify_operation");
860 "migrate_to", NULL) && !partial_migration) {
861 crm_trace(
"Routing %s for %s through remote connection's " 862 "current node %s (moving)%s",
865 partial_migration?
" (partial migration)" :
"");
873 crm_trace(
"Routing %s for %s through remote connection's " 874 "next node %s (moving)%s",
877 partial_migration?
" (partial migration)" :
"");
889 add_node_to_xml_by_id(
const char *
id, xmlNode *xml)
907 add_node_to_xml(
const pe_node_t *node,
void *xml)
909 add_node_to_xml_by_id(node->
details->
id, (xmlNode *) xml);
923 xmlNode *maintenance =
927 for (gIter = data_set->
nodes; gIter != NULL;
928 gIter = gIter->next) {
936 if (details->maintenance != details->remote_maintenance) {
939 add_node_to_xml_by_id(node->
details->
id, maintenance),
945 crm_trace(
"%s %d nodes to adjust maintenance-mode " 946 "to transition", maintenance?
"Added":
"Counted", count);
961 if (add_maintenance_nodes(NULL, data_set)) {
962 crm_trace(
"adding maintenance state update pseudo action");
990 add_node_to_xml_by_id(
action->node->details->id, downed);
995 const char *fence = g_hash_table_lookup(
action->meta,
"stonith_action");
999 add_node_to_xml_by_id(
action->node->details->id, downed);
1011 gboolean migrating = FALSE;
1013 for (iter =
action->actions_before; iter != NULL; iter = iter->next) {
1023 add_node_to_xml_by_id(
action->rsc->id, downed);
1032 if ((
action->rsc->lock_node == NULL) || (
action->node == NULL)
1033 || (
action->node->details !=
action->rsc->lock_node->details)) {
1051 gboolean needs_node_info = TRUE;
1052 gboolean needs_maintenance_info = FALSE;
1053 xmlNode *action_xml = NULL;
1054 xmlNode *args_xml = NULL;
1055 #if ENABLE_VERSIONED_ATTRS 1056 pe_rsc_action_details_t *rsc_details = NULL;
1089 needs_maintenance_info = TRUE;
1092 needs_node_info = FALSE;
1097 #if ENABLE_VERSIONED_ATTRS 1098 rsc_details = pe_rsc_action_details(
action);
1104 if (
action->rsc != NULL &&
action->rsc->clone_name != NULL) {
1105 char *clone_key = NULL;
1115 const char *n_type = g_hash_table_lookup(
action->meta,
"notify_type");
1116 const char *n_task = g_hash_table_lookup(
action->meta,
"notify_operation");
1120 crm_err(
"No notify operation value found for %s",
action->uuid));
1124 }
else if(
action->cancel_task) {
1126 action->cancel_task, interval_ms);
1129 action->task, interval_ms);
1141 if (needs_node_info &&
action->node != NULL) {
1161 xmlNode *rsc_xml = NULL;
1162 const char *attr_list[] = {
1171 if (should_lock_action(
action)) {
1173 (
long long)
action->rsc->lock_time);
1179 crm_element_name(
action->rsc->xml));
1181 &&
action->rsc->clone_name) {
1193 crm_debug(
"Using orphan clone name %s instead of %s",
action->rsc->id,
1194 action->rsc->clone_name);
1199 const char *xml_id =
ID(
action->rsc->xml);
1201 crm_debug(
"Using anonymous clone name %s for %s (aka. %s)", xml_id,
action->rsc->id,
1202 action->rsc->clone_name);
1229 for (lpc = 0; lpc <
PCMK__NELEM(attr_list); lpc++) {
1231 g_hash_table_lookup(
action->rsc->meta, attr_list[lpc]));
1249 const char *remote_addr = g_hash_table_lookup(params,
1255 remote_addr = g_hash_table_lookup(base,
1257 if (remote_addr != NULL) {
1259 strdup(remote_addr));
1265 #if ENABLE_VERSIONED_ATTRS 1269 pe_get_versioned_attributes(versioned_parameters,
action->rsc,
1283 #if ENABLE_VERSIONED_ATTRS 1290 #if ENABLE_VERSIONED_ATTRS 1293 add_node_copy(action_xml, rsc_details->versioned_parameters);
1303 if (
action->rsc != NULL) {
1304 const char *value = g_hash_table_lookup(
action->rsc->meta,
"external-ip");
1307 while (parent != NULL) {
1313 hash2smartfield((gpointer)
"pcmk_external_ip", (gpointer)value, (gpointer)args_xml);
1322 const char *n_task = g_hash_table_lookup(
action->meta,
"notify_operation");
1332 host = pe__current_node(
action->node->details->remote_rsc->container);
1339 host =
action->node->details->remote_rsc->container->allocated_to;
1349 (gpointer)
host->details->uname,
1350 (gpointer)args_xml);
1368 if (needs_node_info && (
action->node != NULL)) {
1369 add_downed_nodes(action_xml,
action, data_set);
1372 if (needs_maintenance_info) {
1373 add_maintenance_nodes(action_xml, data_set);
1408 for (lpc =
action->actions_after; lpc != NULL; lpc = lpc->next) {
1416 || should_dump_action(wrapper->
action)) {
1417 crm_trace(
"Action %s (%d) should be dumped: " 1418 "dependency of %s (%d)",
1427 crm_trace(
"Ignoring action %s (%d): unrunnable",
1433 crm_trace(
"Ignoring action %s (%d): optional",
1441 const char *interval_ms_s = g_hash_table_lookup(
action->meta,
1446 crm_trace(
"Ignoring action %s (%d): for unmanaged resource (%s)",
1458 if (
action->node == NULL) {
1459 pe_err(
"Skipping action %s (%d) " 1460 "because it was not allocated to a node (bug?)",
1466 crm_trace(
"Action %s (%d) should be dumped: " 1467 "can run on DC instead of %s",
1471 && !
action->node->details->remote_requires_reset) {
1472 crm_trace(
"Action %s (%d) should be dumped: " 1473 "assuming will be runnable on guest node %s",
1476 }
else if (
action->node->details->online ==
false) {
1477 pe_err(
"Skipping action %s (%d) " 1478 "because it was scheduled for offline node (bug?)",
1486 }
else if (
action->node->details->unclean ==
false) {
1487 pe_err(
"Skipping action %s (%d) " 1488 "because it was scheduled for unclean node (bug?)",
1499 sort_action_id(gconstpointer a, gconstpointer b)
1546 crm_trace(
"Ignoring %s (%d) input %s (%d): " 1547 "ordering disabled",
1555 crm_trace(
"Ignoring %s (%d) input %s (%d): " 1556 "optional and input unrunnable",
1563 crm_trace(
"Ignoring %s (%d) input %s (%d): " 1564 "one-or-more and input unrunnable",
1571 crm_trace(
"Ignoring %s (%d) input %s (%d): " 1572 "stonith stop but action is pseudo",
1579 crm_trace(
"Ignoring %s (%d) input %s (%d): " 1580 "implies input migratable but input unrunnable",
1587 crm_trace(
"Ignoring %s (%d) input %s (%d): " 1588 "only if input unmigratable but input unrunnable",
1596 crm_trace(
"Ignoring %s (%d) input %s (%d): " 1597 "optional but stop in migration",
1613 if ((input_node == NULL) || (allocated == NULL)
1615 crm_trace(
"Ignoring %s (%d) input %s (%d): " 1616 "load ordering node mismatch %s vs %s",
1625 }
else if ((input_node == NULL) || (
action->node == NULL)
1627 crm_trace(
"Ignoring %s (%d) input %s (%d): " 1628 "load ordering node mismatch %s vs %s",
1631 (
action->node?
action->node->details->uname :
"<none>"),
1637 crm_trace(
"Ignoring %s (%d) input %s (%d): " 1638 "load ordering input optional",
1648 crm_trace(
"Ignoring %s (%d) input %s (%d): " 1649 "anti-colocation node mismatch %s vs %s",
1652 action->node->details->uname,
1658 crm_trace(
"Ignoring %s (%d) input %s (%d): " 1659 "anti-colocation input optional",
1672 crm_warn(
"Ignoring requirement that %s complete before %s:" 1673 " unmanaged failed resources cannot prevent clone shutdown",
1680 && !should_dump_action(input->
action)) {
1681 crm_trace(
"Ignoring %s (%d) input %s (%d): " 1688 crm_trace(
"%s (%d) input %s (%d) @ %s should be dumped: %s, %s, %s, 0x%.6x",
1703 bool has_loop =
false;
1706 crm_trace(
"Breaking tracking loop: %s@%s -> %s@%s (0x%.6x)",
1716 if (!check_dump_input(
action, input)) {
1720 if (input->
action == init_action) {
1721 crm_debug(
"Input loop found in %s@%s ->...-> %s@%s",
1731 crm_trace(
"Checking inputs of action %s@%s input %s@%s (0x%.6x)" 1732 "for graph loop with %s@%s ",
1743 iter != NULL; iter = iter->next) {
1745 if (graph_has_loop(init_action, input->
action,
1757 crm_trace(
"No input loop found in %s@%s -> %s@%s (0x%.6x)",
1778 crm_warn(
"Invalid ordering constraint between %s and %s",
1807 action->actions_before = g_list_sort(
action->actions_before,
1809 for (item =
action->actions_before; item != NULL; item = next) {
1814 crm_trace(
"Input %s (%d) duplicate skipped for action %s (%d)",
1828 action->actions_before = g_list_delete_link(
action->actions_before,
1856 int synapse_priority = 0;
1857 xmlNode *syn = NULL;
1858 xmlNode *
set = NULL;
1860 xmlNode *xml_action = NULL;
1867 deduplicate_inputs(
action);
1871 if (should_dump_action(
action) == FALSE) {
1884 if (
action->rsc != NULL) {
1885 synapse_priority =
action->rsc->priority;
1887 if (
action->priority > synapse_priority) {
1888 synapse_priority =
action->priority;
1890 if (synapse_priority > 0) {
1894 xml_action = action2xml(
action, FALSE, data_set);
1897 for (lpc =
action->actions_before; lpc != NULL; lpc = lpc->next) {
1899 if (check_dump_input(
action, input)) {
1903 xml_action = action2xml(input->
action, TRUE, data_set);
#define CRM_CHECK(expr, failure_action)
const char * task2text(enum action_tasks task)
gboolean parse_op_key(const char *key, char **rsc_id, char **op_type, guint *interval_ms)
#define CRMD_ACTION_MIGRATED
bool pe__is_guest_or_remote_node(const pe_node_t *node)
#define XML_CONFIG_ATTR_SHUTDOWN_LOCK
#define pe__set_action_flags(action, flags_to_set)
gboolean is_parent(pe_resource_t *child, pe_resource_t *rsc)
void hash2field(gpointer key, gpointer value, gpointer user_data)
Set XML attribute based on hash table entry.
#define XML_GRAPH_TAG_MAINTENANCE
void add_maintenance_update(pe_working_set_t *data_set)
pe_resource_t * container
bool pcmk__strcase_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
resource_alloc_functions_t * cmds
Internal tracking for transition graph creation.
enum pe_graph_flags(* update_actions)(pe_action_t *, pe_action_t *, pe_node_t *, enum pe_action_flags, enum pe_action_flags, enum pe_ordering, pe_working_set_t *data_set)
const char * crm_xml_add_int(xmlNode *node, const char *name, int value)
Create an XML attribute with specified name and integer value.
void pe_foreach_guest_node(const pe_working_set_t *data_set, const pe_node_t *host, void(*helper)(const pe_node_t *, void *), void *user_data)
pe_resource_t * remote_rsc
resource_object_functions_t * fns
void pe_action_set_flag_reason(const char *function, long line, pe_action_t *action, pe_action_t *reason, const char *text, enum pe_action_flags flags, bool overwrite)
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
#define pe__clear_graph_flags(graph_flags, gr_action, flags_to_clear)
#define XML_GRAPH_TAG_RSC_OP
#define XML_NODE_IS_MAINTENANCE
enum action_tasks text2task(const char *task)
#define XML_GRAPH_TAG_CRM_EVENT
enum crm_ais_msg_types type
bool pcmk__ends_with(const char *s, const char *match)
void hash2smartfield(gpointer key, gpointer value, gpointer user_data)
Add hash table entry to XML as (possibly legacy) name/value.
#define XML_GRAPH_TAG_DOWNED
#define XML_RSC_ATTR_TARGET
#define pe__set_raw_action_flags(action_flags, action_name, flags_to_set)
#define XML_RSC_ATTR_REMOTE_RA_ADDR
#define XML_GRAPH_TAG_PSEUDO_EVENT
#define XML_CIB_ATTR_PRIORITY
#define XML_LRM_ATTR_TASK_KEY
#define XML_LRM_ATTR_TASK
#define CRM_OP_LRM_REFRESH
pe_node_t *(* location)(const pe_resource_t *, GList **, int)
#define CRM_OP_CLEAR_FAILCOUNT
#define crm_warn(fmt, args...)
#define CRMD_ACTION_RELOAD_AGENT
char * pcmk__notify_key(const char *rsc_id, const char *notify_type, const char *op_type)
int pcmk__guint_from_hash(GHashTable *table, const char *key, guint default_val, guint *result)
pe_action_t * get_pseudo_op(const char *name, pe_working_set_t *data_set)
#define crm_debug(fmt, args...)
pe_resource_t * uber_parent(pe_resource_t *rsc)
#define pe__clear_order_flags(order_flags, flags_to_clear)
gboolean shutdown_constraints(pe_node_t *node, pe_action_t *shutdown_op, pe_working_set_t *data_set)
bool pe__is_guest_node(const pe_node_t *node)
#define pe__clear_action_flags(action, flags_to_clear)
int custom_action_order(pe_resource_t *lh_rsc, char *lh_task, pe_action_t *lh_action, pe_resource_t *rh_rsc, char *rh_task, pe_action_t *rh_action, enum pe_ordering type, pe_working_set_t *data_set)
#define crm_trace(fmt, args...)
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
xmlNode * add_node_copy(xmlNode *new_parent, xmlNode *xml_node)
void rsc_stonith_ordering(pe_resource_t *rsc, pe_action_t *stonith_op, pe_working_set_t *data_set)
struct pe_node_shared_s * details
#define XML_AGENT_ATTR_PROVIDER
gboolean order_actions(pe_action_t *lh_action, pe_action_t *rh_action, enum pe_ordering order)
GHashTable * pe_rsc_params(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set)
Get a table of resource parameters.
Wrappers for and extensions to libxml2.
Internal state tracking when creating graph.
xmlNode * create_xml_node(xmlNode *parent, const char *name)
#define pe__set_graph_flags(graph_flags, gr_action, flags_to_set)
void(* append_meta)(pe_resource_t *rsc, xmlNode *xml)
#define XML_LRM_ATTR_ROUTER_NODE
#define XML_TAG_RSC_VER_ATTRS
void free_xml(xmlNode *child)
#define PCMK__ENV_PHYSICAL_HOST
void update_colo_start_chain(pe_action_t *action, pe_working_set_t *data_set)
enum pe_obj_types variant
gboolean xml_has_children(const xmlNode *root)
char * pcmk__op_key(const char *rsc_id, const char *op_type, guint interval_ms)
Generate an operation key (RESOURCE_ACTION_INTERVAL)
#define CRM_OP_MAINTENANCE_NODES
xmlNode * sorted_xml(xmlNode *input, xmlNode *parent, gboolean recursive)
#define XML_LRM_ATTR_TARGET_UUID
const char * crm_xml_add_ll(xmlNode *node, const char *name, long long value)
Create an XML attribute with specified name and long long int value.
void pcmk__order_vs_fence(pe_action_t *stonith_op, pe_working_set_t *data_set)
void log_action(unsigned int log_level, const char *pre_text, pe_action_t *action, gboolean details)
#define crm_err(fmt, args...)
#define XML_LRM_ATTR_INTERVAL_MS
void hash2metafield(gpointer key, gpointer value, gpointer user_data)
Set XML attribute based on hash table entry, as meta-attribute name.
#define pe__clear_resource_flags(resource, flags_to_clear)
#define XML_ATTR_CRM_VERSION
void graph_element_from_action(pe_action_t *action, pe_working_set_t *data_set)
enum pe_action_flags flags
#define pe_rsc_maintenance
int add_node_nocopy(xmlNode *parent, const char *name, xmlNode *child)
bool pcmk__ordering_is_invalid(pe_action_t *action, pe_action_wrapper_t *input)
gboolean rsc_update_action(pe_action_t *first, pe_action_t *then, enum pe_ordering type)
gboolean update_action(pe_action_t *then, pe_working_set_t *data_set)
#define crm_log_xml_trace(xml, text)
#define XML_LRM_ATTR_TARGET
#define pe_rsc_trace(rsc, fmt, args...)
#define pe__set_order_flags(order_flags, flags_to_set)
#define CRM_OP_LRM_DELETE
#define pe__clear_raw_action_flags(action_flags, action_name, flags_to_clear)
pe_action_t * find_first_action(GList *input, const char *uuid, const char *task, pe_node_t *on_node)
int required_runnable_before
#define XML_AGENT_ATTR_CLASS