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;
   352     if (
action->rsc != NULL) {
   363                && (
action->node != NULL)) {
   390     bool needs_node_info = 
true;
   391     bool needs_maintenance_info = 
false;
   392     xmlNode *action_xml = NULL;
   420             needs_maintenance_info = 
true;
   423         needs_node_info = 
false;
   432     if ((
action->rsc != NULL) && (
action->rsc->clone_name != NULL)) {
   433         char *clone_key = NULL;
   440         clone_key = clone_op_key(
action, interval_ms);
   448     if (needs_node_info && (
action->node != NULL)) {
   449         add_node_details(
action, action_xml);
   451                             strdup(
action->node->details->uname));
   453                             strdup(
action->node->details->id));
   464         add_resource_details(
action, action_xml);
   468     add_action_attributes(
action, action_xml);
   471     if (needs_node_info && (
action->node != NULL)) {
   475     if (needs_maintenance_info) {
   476         add_maintenance_nodes(action_xml, 
data_set);
   492         crm_trace(
"Ignoring action %s (%d): unrunnable",
   499         crm_trace(
"Ignoring action %s (%d): optional",
   510         const char *interval_ms_s;
   517         interval_ms_s = g_hash_table_lookup(
action->meta,
   520             crm_trace(
"Ignoring action %s (%d): for unmanaged resource (%s)",
   535     if (
action->node == NULL) {
   536         pe_err(
"Skipping action %s (%d) "   537                "because it was not allocated to a node (bug?)",
   544         crm_trace(
"Action %s (%d) should be dumped: "   545                   "can run on DC instead of %s",
   549                && !
action->node->details->remote_requires_reset) {
   550         crm_trace(
"Action %s (%d) should be dumped: "   551                   "assuming will be runnable on guest %s",
   554     } 
else if (!
action->node->details->online) {
   555         pe_err(
"Skipping action %s (%d) "   556                "because it was scheduled for offline node (bug?)",
   561     } 
else if (
action->node->details->unclean) {
   562         pe_err(
"Skipping action %s (%d) "   563                "because it was scheduled for unclean node (bug?)",
   606         crm_trace(
"Ignoring %s (%d) input %s (%d): "   613                && !ordering_can_change_actions(
input)) {
   614         crm_trace(
"Ignoring %s (%d) input %s (%d): "   615                   "optional and input unrunnable",
   622         crm_trace(
"Ignoring %s (%d) input %s (%d): "   623                   "one-or-more and input unrunnable",
   630         crm_trace(
"Ignoring %s (%d) input %s (%d): "   631                   "implies input migratable but input unrunnable",
   638         crm_trace(
"Ignoring %s (%d) input %s (%d): "   639                   "only if input unmigratable but input unrunnable",
   647         crm_trace(
"Ignoring %s (%d) input %s (%d): "   648                   "optional but stop in migration",
   664             if ((input_node == NULL) || (allocated == NULL)
   666                 crm_trace(
"Ignoring %s (%d) input %s (%d): "   667                           "load ordering node mismatch %s vs %s",
   676         } 
else if ((input_node == NULL) || (
action->node == NULL)
   678             crm_trace(
"Ignoring %s (%d) input %s (%d): "   679                       "load ordering node mismatch %s vs %s",
   682                       (
action->node? 
action->node->details->uname : 
"<none>"),
   688             crm_trace(
"Ignoring %s (%d) input %s (%d): "   689                       "load ordering input optional",
   698             && (
input->action->node->details != 
action->node->details)) {
   699             crm_trace(
"Ignoring %s (%d) input %s (%d): "   700                       "anti-colocation node mismatch %s vs %s",
   703                       pe__node_name(
action->node),
   704                       pe__node_name(
input->action->node));
   709             crm_trace(
"Ignoring %s (%d) input %s (%d): "   710                       "anti-colocation input optional",
   717     } 
else if (
input->action->rsc
   723         crm_warn(
"Ignoring requirement that %s complete before %s:"   724                  " unmanaged failed resources cannot prevent clone shutdown",
   729                && !pcmk_any_flags_set(
input->action->flags,
   731                && !should_add_action_to_graph(
input->action)) {
   732         crm_trace(
"Ignoring %s (%d) input %s (%d): "   739     crm_trace(
"%s (%d) input %s %s (%d) on %s should be dumped: %s %s %#.6x",
   764     bool has_loop = 
false;
   767         crm_trace(
"Breaking tracking loop: %s@%s -> %s@%s (%#.6x)",
   769                   input->action->node? 
input->action->node->details->uname : 
"",
   781     if (
input->action == init_action) {
   782         crm_debug(
"Input loop found in %s@%s ->...-> %s@%s",
   792     crm_trace(
"Checking inputs of action %s@%s input %s@%s (%#.6x)"   793               "for graph loop with %s@%s ",
   797               input->action->node? 
input->action->node->details->uname : 
"",
   803     for (GList *iter = 
input->action->actions_before;
   804          iter != NULL; iter = iter->next) {
   817         crm_trace(
"No input loop found in %s@%s -> %s@%s (%#.6x)",
   819                   input->action->node? 
input->action->node->details->uname : 
"",
   839     int synapse_priority = 0;
   845     if (
action->rsc != NULL) {
   846         synapse_priority = 
action->rsc->priority;
   848     if (
action->priority > synapse_priority) {
   849         synapse_priority = 
action->priority;
   851     if (synapse_priority > 0) {
   874 add_action_to_graph(gpointer 
data, gpointer user_data)
   893         || !should_add_action_to_graph(
action)) {       
   898     crm_trace(
"Adding action %d (%s%s%s) to graph",
   900               ((
action->node == NULL)? 
"" : 
" on "),
   901               ((
action->node == NULL)? 
"" : 
action->node->details->uname));
   909     for (GList *lpc = 
action->actions_before; lpc != NULL; lpc = lpc->next) {
   916             create_graph_action(input_xml, 
input->action, 
true, 
data_set);
   921 static int transition_id = -1;
   933         crm_err(
"Calculated transition %d (with errors)%s%s",
   935                 (filename == NULL)? 
"" : 
", saving inputs in ",
   936                 (filename == NULL)? 
"" : filename);
   939         crm_warn(
"Calculated transition %d (with warnings)%s%s",
   941                  (filename == NULL)? 
"" : 
", saving inputs in ",
   942                  (filename == NULL)? 
"" : filename);
   947                    (filename == NULL)? 
"" : 
", saving inputs in ",
   948                    (filename == NULL)? 
"" : filename);
   951         crm_notice(
"Configuration errors found during scheduler processing,"   952                    "  please run \"crm_verify -L\" to identify issues");
   974     for (iter = rsc->
children; iter != NULL; iter = iter->next) {
   991     const char *value = NULL;
   992     long long limit = 0LL;
   995     crm_trace(
"Creating transition graph %d", transition_id);
  1024         char *recheck_epoch = NULL;
  1029         free(recheck_epoch);
  1052         if ((
action->rsc != NULL)
  1053             && (
action->node != NULL)
  1054             && 
action->node->details->shutdown
  1056             && !pcmk_any_flags_set(
action->flags,
  1065                 crm_crit(
"Cannot %s %s because of %s:%s%s (%s)",
  1066                          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)
 
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
 
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
 
void(* add_actions_to_graph)(pe_resource_t *rsc)
 
G_GNUC_INTERNAL void pcmk__substitute_remote_addr(pe_resource_t *rsc, GHashTable *params)
 
#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_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...)
 
void pcmk__add_rsc_actions_to_graph(pe_resource_t *rsc)
 
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. 
 
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
 
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
 
void free_xml(xmlNode *child)
 
bool pcmk__str_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
 
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...)
 
GHashTable * pe_rsc_params(pe_resource_t *rsc, const pe_node_t *node, pe_working_set_t *data_set)
Get a table of resource parameters. 
 
#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
 
pe_working_set_t * cluster
 
#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__create_graph(pe_working_set_t *data_set)
 
#define XML_AGENT_ATTR_CLASS