12 #include <sys/param.h> 26 #define action_type_str(flags) \ 27 (pcmk_is_set((flags), pe_action_pseudo)? "pseudo-action" : "action") 29 #define action_optional_str(flags) \ 30 (pcmk_is_set((flags), pe_action_optional)? "optional" : "required") 32 #define action_runnable_str(flags) \ 33 (pcmk_is_set((flags), pe_action_runnable)? "runnable" : "unrunnable") 35 #define action_node_str(a) \ 36 (((a)->node == NULL)? "no node" : (a)->node->details->uname) 46 add_node_to_xml_by_id(
const char *
id, xmlNode *xml)
64 add_node_to_xml(
const pe_node_t *node,
void *xml)
66 add_node_to_xml_by_id(node->
details->
id, (xmlNode *) xml);
80 xmlNode *maintenance =
85 gIter = gIter->next) {
93 if (details->maintenance != details->remote_maintenance) {
96 add_node_to_xml_by_id(node->
details->
id, maintenance),
102 crm_trace(
"%s %d nodes to adjust maintenance-mode " 103 "to transition", maintenance?
"Added":
"Counted", count);
118 if (add_maintenance_nodes(NULL,
data_set)) {
119 crm_trace(
"adding maintenance state update pseudo action");
147 add_node_to_xml_by_id(
action->node->details->id, downed);
152 const char *fence = g_hash_table_lookup(
action->meta,
"stonith_action");
156 add_node_to_xml_by_id(
action->node->details->id, downed);
168 gboolean migrating = FALSE;
170 for (iter =
action->actions_before; iter != NULL; iter = iter->next) {
180 add_node_to_xml_by_id(
action->rsc->id, downed);
198 const char *n_type = g_hash_table_lookup(
action->meta,
"notify_type");
199 const char *n_task = g_hash_table_lookup(
action->meta,
205 }
else if (
action->cancel_task != NULL) {
227 if (router_node != NULL) {
242 xmlNode *rsc_xml = NULL;
243 const char *attr_list[] = {
254 (
long long)
action->rsc->lock_time);
261 && (
action->rsc->clone_name != NULL)) {
270 crm_debug(
"Using orphan clone name %s instead of %s",
276 const char *xml_id =
ID(
action->rsc->xml);
278 crm_debug(
"Using anonymous clone name %s for %s (aka %s)",
295 if ((
action->rsc->clone_name != NULL)
296 && !pcmk__str_eq(xml_id,
action->rsc->clone_name,
308 for (
int lpc = 0; lpc <
PCMK__NELEM(attr_list); lpc++) {
310 g_hash_table_lookup(
action->rsc->meta, attr_list[lpc]));
324 xmlNode *args_xml = NULL;
344 #if ENABLE_VERSIONED_ATTRS 348 pe_get_versioned_attributes(versioned_parameters,
action->rsc,
363 #if ENABLE_VERSIONED_ATTRS 370 #if ENABLE_VERSIONED_ATTRS 371 if (rsc_details != NULL) {
373 add_node_copy(action_xml, rsc_details->versioned_parameters);
382 if (
action->rsc != NULL) {
383 const char *value = g_hash_table_lookup(
action->rsc->meta,
394 (gpointer) args_xml);
400 && (
action->node != NULL)) {
427 bool needs_node_info =
true;
428 bool needs_maintenance_info =
false;
429 xmlNode *action_xml = NULL;
430 #if ENABLE_VERSIONED_ATTRS 431 pe_rsc_action_details_t *rsc_details = NULL;
461 needs_maintenance_info =
true;
464 needs_node_info =
false;
468 #if ENABLE_VERSIONED_ATTRS 469 rsc_details = pe_rsc_action_details(
action);
476 if ((
action->rsc != NULL) && (
action->rsc->clone_name != NULL)) {
477 char *clone_key = NULL;
484 clone_key = clone_op_key(
action, interval_ms);
492 if (needs_node_info && (
action->node != NULL)) {
493 add_node_details(
action, action_xml);
495 strdup(
action->node->details->uname));
497 strdup(
action->node->details->id));
508 add_resource_details(
action, action_xml);
512 add_action_attributes(
action, action_xml);
515 if (needs_node_info && (
action->node != NULL)) {
519 if (needs_maintenance_info) {
520 add_maintenance_nodes(action_xml,
data_set);
536 crm_trace(
"Ignoring action %s (%d): unrunnable",
543 crm_trace(
"Ignoring action %s (%d): optional",
554 const char *interval_ms_s;
561 interval_ms_s = g_hash_table_lookup(
action->meta,
564 crm_trace(
"Ignoring action %s (%d): for unmanaged resource (%s)",
579 if (
action->node == NULL) {
580 pe_err(
"Skipping action %s (%d) " 581 "because it was not allocated to a node (bug?)",
588 crm_trace(
"Action %s (%d) should be dumped: " 589 "can run on DC instead of %s",
593 && !
action->node->details->remote_requires_reset) {
594 crm_trace(
"Action %s (%d) should be dumped: " 595 "assuming will be runnable on guest node %s",
598 }
else if (!
action->node->details->online) {
599 pe_err(
"Skipping action %s (%d) " 600 "because it was scheduled for offline node (bug?)",
605 }
else if (
action->node->details->unclean) {
606 pe_err(
"Skipping action %s (%d) " 607 "because it was scheduled for unclean node (bug?)",
650 crm_trace(
"Ignoring %s (%d) input %s (%d): " 657 && !ordering_can_change_actions(
input)) {
658 crm_trace(
"Ignoring %s (%d) input %s (%d): " 659 "optional and input unrunnable",
666 crm_trace(
"Ignoring %s (%d) input %s (%d): " 667 "one-or-more and input unrunnable",
674 crm_trace(
"Ignoring %s (%d) input %s (%d): " 675 "implies input migratable but input unrunnable",
682 crm_trace(
"Ignoring %s (%d) input %s (%d): " 683 "only if input unmigratable but input unrunnable",
691 crm_trace(
"Ignoring %s (%d) input %s (%d): " 692 "optional but stop in migration",
708 if ((input_node == NULL) || (allocated == NULL)
710 crm_trace(
"Ignoring %s (%d) input %s (%d): " 711 "load ordering node mismatch %s vs %s",
720 }
else if ((input_node == NULL) || (
action->node == NULL)
722 crm_trace(
"Ignoring %s (%d) input %s (%d): " 723 "load ordering node mismatch %s vs %s",
726 (
action->node?
action->node->details->uname :
"<none>"),
732 crm_trace(
"Ignoring %s (%d) input %s (%d): " 733 "load ordering input optional",
742 && (
input->action->node->details !=
action->node->details)) {
743 crm_trace(
"Ignoring %s (%d) input %s (%d): " 744 "anti-colocation node mismatch %s vs %s",
747 action->node->details->uname,
748 input->action->node->details->uname);
753 crm_trace(
"Ignoring %s (%d) input %s (%d): " 754 "anti-colocation input optional",
761 }
else if (
input->action->rsc
767 crm_warn(
"Ignoring requirement that %s complete before %s:" 768 " unmanaged failed resources cannot prevent clone shutdown",
773 && !pcmk_any_flags_set(
input->action->flags,
775 && !should_add_action_to_graph(
input->action)) {
776 crm_trace(
"Ignoring %s (%d) input %s (%d): " 783 crm_trace(
"%s (%d) input %s %s (%d) on %s should be dumped: %s %s %#.6x",
808 bool has_loop =
false;
811 crm_trace(
"Breaking tracking loop: %s@%s -> %s@%s (%#.6x)",
813 input->action->node?
input->action->node->details->uname :
"",
825 if (
input->action == init_action) {
826 crm_debug(
"Input loop found in %s@%s ->...-> %s@%s",
836 crm_trace(
"Checking inputs of action %s@%s input %s@%s (%#.6x)" 837 "for graph loop with %s@%s ",
841 input->action->node?
input->action->node->details->uname :
"",
847 for (GList *iter =
input->action->actions_before;
848 iter != NULL; iter = iter->next) {
861 crm_trace(
"No input loop found in %s@%s -> %s@%s (%#.6x)",
863 input->action->node?
input->action->node->details->uname :
"",
883 int synapse_priority = 0;
889 if (
action->rsc != NULL) {
890 synapse_priority =
action->rsc->priority;
892 if (
action->priority > synapse_priority) {
893 synapse_priority =
action->priority;
895 if (synapse_priority > 0) {
934 || !should_add_action_to_graph(
action)) {
945 for (GList *lpc =
action->actions_before; lpc != NULL; lpc = lpc->next) {
952 create_graph_action(input_xml,
input->action,
true,
data_set);
957 static int transition_id = -1;
969 crm_err(
"Calculated transition %d (with errors)%s%s",
971 (filename == NULL)?
"" :
", saving inputs in ",
972 (filename == NULL)?
"" : filename);
975 crm_warn(
"Calculated transition %d (with warnings)%s%s",
977 (filename == NULL)?
"" :
", saving inputs in ",
978 (filename == NULL)?
"" : filename);
983 (filename == NULL)?
"" :
", saving inputs in ",
984 (filename == NULL)?
"" : filename);
987 crm_notice(
"Configuration errors found during scheduler processing," 988 " please run \"crm_verify -L\" to identify issues");
1002 const char *value = NULL;
1003 long long limit = 0LL;
1006 crm_trace(
"Creating transition graph %d", transition_id);
1035 char *recheck_epoch = NULL;
1040 free(recheck_epoch);
1063 if ((
action->rsc != NULL)
1064 && (
action->node != NULL)
1065 &&
action->node->details->shutdown
1067 && !pcmk_any_flags_set(
action->flags,
1076 crm_crit(
"Cannot %s node '%s' because of %s:%s%s (%s)",
1077 action->node->details->unclean?
"fence" :
"shut down",
G_GNUC_INTERNAL bool pcmk__action_locks_rsc_to_node(const pe_action_t *action)
#define CRM_CHECK(expr, failure_action)
G_GNUC_INTERNAL void pcmk__substitute_remote_addr(pe_resource_t *rsc, GHashTable *params, pe_working_set_t *data_set)
enum pe_quorum_policy no_quorum_policy
#define crm_notice(fmt, args...)
#define CRMD_ACTION_MIGRATED
bool pe__is_guest_or_remote_node(const pe_node_t *node)
#define XML_CONFIG_ATTR_SHUTDOWN_LOCK
#define crm_crit(fmt, args...)
#define pe__set_action_flags(action, flags_to_set)
void hash2field(gpointer key, gpointer value, gpointer user_data)
Set XML attribute based on hash table entry.
G_GNUC_INTERNAL void pcmk__deduplicate_action_inputs(pe_action_t *action)
#define XML_GRAPH_TAG_MAINTENANCE
bool pcmk__strcase_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
#define action_type_str(flags)
resource_alloc_functions_t * cmds
Internal tracking for transition graph creation.
bool pcmk__graph_has_loop(pe_action_t *init_action, pe_action_t *action, pe_action_wrapper_t *input)
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)
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
void pcmk__log_transition_summary(const char *filename)
#define XML_GRAPH_TAG_RSC_OP
#define XML_NODE_IS_MAINTENANCE
#define CRM_LOG_ASSERT(expr)
const char * pe_pref(GHashTable *options, const char *name)
#define XML_GRAPH_TAG_CRM_EVENT
void add_maintenance_update(pe_working_set_t *data_set)
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 pe_flag_have_quorum
#define XML_GRAPH_TAG_PSEUDO_EVENT
#define XML_CIB_ATTR_PRIORITY
G_GNUC_INTERNAL pe_node_t * pcmk__connection_host_for_action(pe_action_t *action)
#define XML_LRM_ATTR_TASK_KEY
#define XML_LRM_ATTR_TASK
#define CRM_OP_LRM_REFRESH
#define CRM_OP_CLEAR_FAILCOUNT
gboolean crm_config_error
int pcmk__scan_ll(const char *text, long long *result, long long default_value)
#define crm_warn(fmt, args...)
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...)
bool pe__is_guest_node(const pe_node_t *node)
#define pe__clear_action_flags(action, flags_to_clear)
#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)
G_GNUC_INTERNAL void pcmk__log_action(const char *pre_text, pe_action_t *action, bool details)
struct pe_node_shared_s * details
#define XML_AGENT_ATTR_PROVIDER
GHashTable * pe_rsc_params(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set)
Get a table of resource parameters.
void(* expand)(pe_resource_t *, pe_working_set_t *)
pe_working_set_t * data_set
Wrappers for and extensions to libxml2.
Internal state tracking when creating graph.
bool pcmk__is_fencing_action(const char *action)
xmlNode * create_xml_node(xmlNode *parent, const char *name)
#define XML_LRM_ATTR_ROUTER_NODE
#define XML_TAG_RSC_VER_ATTRS
void free_xml(xmlNode *child)
bool pcmk__str_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
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.
G_GNUC_INTERNAL void pcmk__add_bundle_meta_to_xml(xmlNode *args_xml, pe_action_t *action)
Add special bundle meta-attributes to XML.
#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 XML_ATTR_CRM_VERSION
#define pe_rsc_maintenance
#define crm_log_xml_trace(xml, text)
#define XML_LRM_ATTR_TARGET
#define action_optional_str(flags)
#define pe_rsc_trace(rsc, fmt, args...)
#define action_node_str(a)
gboolean was_processing_error
#define action_runnable_str(flags)
gboolean was_processing_warning
#define CRM_OP_LRM_DELETE
#define pe_flag_start_failure_fatal
void pcmk__add_action_to_graph(pe_action_t *action, pe_working_set_t *data_set)
void pcmk__create_graph(pe_working_set_t *data_set)
#define XML_AGENT_ATTR_CLASS