13 #include <sys/param.h>    36     bool runnable = 
false;
    49     if ((node == NULL) || !pe_rsc_is_clone(
action->rsc)) {
    95 action_uuid_for_ordering(
const char *first_uuid, 
pe_resource_t *first_rsc)
    97     guint interval_ms = 0;
   100     char *first_task_str = NULL;
   105     if ((strstr(first_uuid, 
"notify") != NULL)
   112     if (interval_ms > 0) {
   117     switch (first_task) {
   123             remapped_task = first_task + 1;
   130             remapped_task = first_task;
   137             crm_err(
"Unknown action '%s' in ordering", first_task_str);
   148             && ((first_rsc->
parent == NULL)
   149                 || (pe_rsc_is_clone(first_rsc)
   157                      "Remapped action UUID %s to %s for ordering purposes",
   163         uuid = strdup(first_uuid);
   166     free(first_task_str);
   194         char *uuid = action_uuid_for_ordering(
action->uuid, rsc);
   198             crm_warn(
"Not remapping %s to %s because %s does not have "   199                      "remapped action", 
action->uuid, uuid, rsc->
id);
   246                      "%s then %s: mapped pe_order_implies_then_on_node to "   247                      "pe_order_implies_then on %s",
   252         if (then->
rsc != NULL) {
   265                      (changed? 
"changed" : 
"unchanged"));
   272                                                    first_flags, restart,
   276                      (changed? 
"changed" : 
"unchanged"));
   280         if (first->
rsc != NULL) {
   293                      (changed? 
"changed" : 
"unchanged"));
   297         if (then->
rsc != NULL) {
   305                      "%s then %s: %s after pe_order_promoted_implies_first",
   307                      (changed? 
"changed" : 
"unchanged"));
   311         if (then->
rsc != NULL) {
   334                      (changed? 
"changed" : 
"unchanged"));
   342                          "%s then %s: ignoring because first is stopping",
   354                      (changed? 
"changed" : 
"unchanged"));
   358         if (then->
rsc != NULL) {
   373                      (changed? 
"changed" : 
"unchanged"));
   377         if (then->
rsc != NULL) {
   383                      "pe_order_implies_first_migratable",
   385                      (changed? 
"changed" : 
"unchanged"));
   389         if (then->
rsc != NULL) {
   398                      (changed? 
"changed" : 
"unchanged"));
   402         if (then->
rsc != NULL) {
   411                      (changed? 
"changed" : 
"unchanged"));
   415         if (then->
rsc != NULL) {
   424                      (changed? 
"changed" : 
"unchanged"));
   449         && (first->
rsc != NULL)
   460                      "is blocked, unmanaged, unrunnable stop",
   462                      (changed? 
"changed" : 
"unchanged"));
   470 #define action_type_str(flags) \   471     (pcmk_is_set((flags), pe_action_pseudo)? "pseudo-action" : "action")   473 #define action_optional_str(flags) \   474     (pcmk_is_set((flags), pe_action_optional)? "optional" : "required")   476 #define action_runnable_str(flags) \   477     (pcmk_is_set((flags), pe_action_runnable)? "runnable" : "unrunnable")   479 #define action_node_str(a) \   480     (((a)->node == NULL)? "no node" : (a)->node->details->uname)   494     int last_flags = then->
flags;
   529         if ((first->
rsc != NULL)
   534             if (first_node != NULL) {
   536                              first_node->details->uname, first->
uuid);
   540         if ((then->
rsc != NULL)
   545             if (then_node != NULL) {
   547                              then_node->details->uname, then->
uuid);
   553             && (first_node != NULL) && (then_node != NULL)
   554             && (first_node->details != then_node->details)) {
   557                          "Disabled ordering %s on %s then %s on %s: not same node",
   558                          other->
action->
uuid, first_node->details->uname,
   559                          then->
uuid, then_node->details->uname);
   566         if ((first->
rsc != NULL)
   579         if ((first->
rsc != NULL) && (then->
rsc != NULL)
   581             first = action_for_ordering(first);
   583         if (first != other->
action) {
   589                      "%s (%#.6x) then %s (%#.6x): type=%#.6x node=%s",
   593         if (first == other->
action) {
   600             first_flags = action_flags_for_ordering(first, then_node);
   601             then_flags = action_flags_for_ordering(then, first_node);
   603             changed |= update_action_for_ordering_flags(first, then,
   604                                                         first_flags, then_flags,
   620                          "Disabled ordering %s then %s in favor of %s then %s",
   628             crm_trace(
"Re-processing %s and its 'after' actions "   629                       "because it changed", first->
uuid);
   641         if (last_flags == then->
flags) {
   649         crm_trace(
"Re-processing %s and its 'after' actions because it changed",
   656         for (lpc = then->
actions_after; lpc != NULL; lpc = lpc->next) {
   675     const char *node_uname = NULL;
   676     const char *node_uuid = NULL;
   677     const char *desc = NULL;
   682         if (
action->node != NULL) {
   683             node_uname = 
action->node->details->uname;
   684             node_uuid = 
action->node->details->id;
   686             node_uname = 
"<none>";
   698                 desc = 
"!!Non-Startable!! ";
   702                desc = 
"(Provisional) ";
   704             crm_trace(
"%s%s%sAction %d: %s%s%s%s%s%s",
   705                       ((pre_text == NULL)? 
"" : pre_text),
   706                       ((pre_text == NULL)? 
"" : 
": "),
   708                       (node_uname? 
"\ton " : 
""), (node_uname? node_uname : 
""),
   709                       (node_uuid? 
"\t\t(" : 
""), (node_uuid? node_uuid : 
""),
   710                       (node_uuid? 
")" : 
""));
   718                 desc = 
"!!Non-Startable!! ";
   722                desc = 
"(Provisional) ";
   724             crm_trace(
"%s%s%sAction %d: %s %s%s%s%s%s%s",
   725                       ((pre_text == NULL)? 
"" : pre_text),
   726                       ((pre_text == NULL)? 
"" : 
": "),
   729                       (node_uname? 
"\ton " : 
""), (node_uname? node_uname : 
""),
   730                       (node_uuid? 
"\t\t(" : 
""), (node_uuid? node_uuid : 
""),
   731                       (node_uuid? 
")" : 
""));
   738         crm_trace(
"\t\t====== Preceding Actions");
   739         for (iter = 
action->actions_before; iter != NULL; iter = iter->next) {
   744         crm_trace(
"\t\t====== Subsequent Actions");
   745         for (iter = 
action->actions_after; iter != NULL; iter = iter->next) {
   754                   g_list_length(
action->actions_before),
   755                   g_list_length(
action->actions_after));
   772                             bool optional, 
bool runnable)
   805     char *interval_ms_s = NULL;
   807     CRM_ASSERT((rsc != NULL) && (task != NULL) && (node != NULL));
   838     char *shutdown_id = NULL;
   869     xmlNode *args_xml = NULL;
   883 #define FAKE_TE_ID     "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"   900                          const char *caller_version, 
int target_rc,
   901                          const char *node, 
const char *origin)
   906     char *op_id_additional = NULL;
   907     char *local_user_data = NULL;
   908     const char *exit_reason = NULL;
   910     xmlNode *xml_op = NULL;
   911     const char *task = NULL;
   914     crm_trace(
"Creating history XML for %s-interval %s action for %s on %s "   915               "(DC version: %s, origin: %s)",
   917               ((node == NULL)? 
"no node" : node), caller_version, origin);
   974     if (xml_op == NULL) {
  1010                       "): last=%u change=%u exec=%u queue=%u",
  1020                                (
long long) op->
t_run);
  1040     add_op_digest_to_xml(op, xml_op);
  1042     if (op_id_additional) {
  1044         op_id = op_id_additional;
  1045         op_id_additional = NULL;
  1049     if (local_user_data) {
  1050         free(local_user_data);
  1078         || (
action->rsc->lock_node == NULL) || (
action->node == NULL)
  1079         || (
action->node->details != 
action->rsc->lock_node->details)) {
  1086     if (
action->node->details->shutdown && (
action->task != NULL)
  1096 sort_action_id(gconstpointer a, gconstpointer b)
  1129     action->actions_before = g_list_sort(
action->actions_before,
  1131     for (item = 
action->actions_before; item != NULL; item = next) {
  1135         if ((last_input != NULL)
  1137             crm_trace(
"Input %s (%d) duplicate skipped for action %s (%d)",
  1151             action->actions_before = g_list_delete_link(
action->actions_before,
  1172     for (GList *iter = 
data_set->
actions; iter != NULL; iter = iter->next) {
  1173         char *node_name = NULL;
  1177         if (
action->rsc != NULL) {
  1185             task = strdup(
"Shutdown");
  1188             const char *op = g_hash_table_lookup(
action->meta, 
"stonith_action");
  1198                                           action->node->details->uname,
  1199                                           action->node->details->remote_rsc->container->id);
  1200         } 
else if (
action->node != NULL) {
  1204         out->
message(out, 
"node-action", task, node_name, 
action->reason);
  1230 schedule_cancel(
pe_resource_t *rsc, 
const char *call_id, 
const char *task,
  1231                 guint interval_ms, 
pe_node_t *node, 
const char *reason)
  1235     CRM_CHECK((rsc != NULL) && (task != NULL)
  1236               && (node != NULL) && (reason != NULL),
  1239     crm_info(
"Recurring %s-interval %s for %s will be stopped on %s: %s",
  1261 action_in_config(
pe_resource_t *rsc, 
const char *task, guint interval_ms)
  1280 task_for_digest(
const char *task, guint interval_ms)
  1285     if ((interval_ms == 0)
  1313     const char *digest_secure = NULL;
  1337 force_restart(
pe_resource_t *rsc, 
const char *task, guint interval_ms,
  1359 reschedule_recurring(
pe_resource_t *rsc, 
const char *task, guint interval_ms,
  1367                        task, node, TRUE, TRUE, rsc->
cluster);
  1385         g_list_foreach(rsc->
children, (GFunc) schedule_reload, node);
  1405         pe_rsc_trace(rsc, 
"%s: preventing agent reload because start pending",
  1444     guint interval_ms = 0;
  1445     const char *task = NULL;
  1448     CRM_CHECK((rsc != NULL) && (node != NULL) && (xml_op != NULL),
  1457     if (interval_ms > 0) {
  1458         if (action_in_config(rsc, task, interval_ms)) {
  1459             pe_rsc_trace(rsc, 
"%s-interval %s for %s on %s is in configuration",
  1464             schedule_cancel(rsc,
  1466                             task, interval_ms, node, 
"orphan");
  1469             pe_rsc_debug(rsc, 
"%s-interval %s for %s on %s is orphaned",
  1476     crm_trace(
"Checking %s-interval %s for %s on %s for configuration changes",
  1479     task = task_for_digest(task, interval_ms);
  1482     if (only_sanitized_changed(xml_op, digest_data, rsc->
cluster)) {
  1487                       "Only 'private' parameters to %s-interval %s for %s "  1488                       "on %s changed: %s",
  1496     switch (digest_data->
rc) {
  1499             force_restart(rsc, task, interval_ms, node);
  1506             if (interval_ms > 0) {
  1512                 reschedule_recurring(rsc, task, interval_ms, node);
  1518                                   "Device parameters changed (reload)", NULL,
  1521                 schedule_reload(rsc, node);
  1525                              "Restarting %s because agent doesn't support reload",
  1529                 force_restart(rsc, task, interval_ms, node);
  1550                     int *start_index, 
int *stop_index)
  1556         ops = g_list_prepend(ops, rsc_op);
  1582     int start_index = 0;
  1583     GList *sorted_op_list = NULL;
  1588                          "Skipping configuration check "  1589                          "for orphaned clone instance %s",
  1593                          "Skipping configuration check and scheduling clean-up "  1594                          "for orphaned resource %s", rsc->
id);
  1605                      "Skipping configuration check for %s "  1606                      "because no longer active on %s",
  1611     pe_rsc_trace(rsc, 
"Checking for configuration changes for %s on %s",
  1618     sorted_op_list = rsc_history_as_list(rsc, rsc_entry, &start_index,
  1620     if (start_index < stop_index) {
  1624     for (GList *iter = sorted_op_list; iter != NULL; iter = iter->next) {
  1625         xmlNode *rsc_op = (xmlNode *) iter->data;
  1626         const char *task = NULL;
  1627         guint interval_ms = 0;
  1629         if (++offset < start_index) {
  1637         if ((interval_ms > 0)
  1641             schedule_cancel(rsc,
  1643                             task, interval_ms, node, 
"maintenance mode");
  1645         } 
else if ((interval_ms > 0)
  1671     g_list_free(sorted_op_list);
  1698             for (GList *iter = 
result; iter != NULL; iter = iter->next) {
  1702                     process_rsc_history(rsc_entry, rsc, node);
  1711 #define XPATH_NODE_HISTORY "/" XML_TAG_CIB "/" XML_CIB_TAG_STATUS             \  1712                            "/" XML_CIB_TAG_STATE "[@" XML_ATTR_UNAME "='%s']" \  1713                            "/" XML_CIB_TAG_LRM "/" XML_LRM_TAG_RESOURCES  1730     crm_trace(
"Check resource and action configuration for changes");
  1736     for (GList *iter = 
data_set->
nodes; iter != NULL; iter = iter->next) {
  1745             xmlNode *history = NULL;
  1751             process_node_history(node, history, 
data_set);
 
#define CRM_CHECK(expr, failure_action)
 
#define XML_RSC_OP_LAST_CHANGE
 
void pcmk__output_actions(pe_working_set_t *data_set)
 
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
 
#define pe_flag_stop_action_orphans
 
#define pe_rsc_debug(rsc, fmt, args...)
 
#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. 
 
gboolean DeleteRsc(pe_resource_t *rsc, pe_node_t *node, gboolean optional, pe_working_set_t *data_set)
 
const char * crm_xml_add_ms(xmlNode *node, const char *name, guint ms)
Create an XML attribute with specified name and unsigned value. 
 
#define XML_ATTR_TRANSITION_MAGIC
 
void pe__add_param_check(xmlNode *rsc_op, pe_resource_t *rsc, pe_node_t *node, enum pe_check_parameters, pe_working_set_t *data_set)
 
bool pcmk__strcase_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
 
int(* message)(pcmk__output_t *out, const char *message_id,...)
 
G_GNUC_INTERNAL bool pcmk__node_available(const pe_node_t *node)
 
resource_alloc_functions_t * cmds
 
G_GNUC_INTERNAL void pcmk__order_stops_before_shutdown(pe_node_t *node, pe_action_t *shutdown_op, pe_working_set_t *data_set)
 
Internal tracking for transition graph creation. 
 
xmlNode * first_named_child(const xmlNode *parent, const char *name)
 
void pcmk__update_action_for_orderings(pe_action_t *then, pe_working_set_t *data_set)
 
G_GNUC_INTERNAL void pcmk__new_ordering(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)
 
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)
 
pe_action_t * pcmk__new_shutdown_action(pe_node_t *node, 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. 
 
#define CRMD_ACTION_NOTIFY
 
#define XML_RSC_OP_T_EXEC
 
const char * crm_meta_value(GHashTable *hash, const char *field)
 
resource_object_functions_t * fns
 
xmlNode * pcmk__xe_match(xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
 
#define XML_LRM_TAG_RESOURCE
 
pe_action_t * pcmk__new_cancel_action(pe_resource_t *rsc, const char *task, guint interval_ms, pe_node_t *node)
 
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value. 
 
#define XML_LRM_ATTR_OP_DIGEST
 
#define pe__clear_graph_flags(graph_flags, gr_action, flags_to_clear)
 
bool pe__bundle_needs_remote_name(pe_resource_t *rsc, pe_working_set_t *data_set)
 
pe_action_t * pcmk__new_rsc_pseudo_action(pe_resource_t *rsc, const char *task, bool optional, bool runnable)
 
gint sort_op_by_callid(gconstpointer a, gconstpointer b)
 
xmlNode * pcmk__create_history_xml(xmlNode *parent, lrmd_event_data_t *op, const char *caller_version, int target_rc, const char *node, const char *origin)
 
void pcmk__filter_op_for_digest(xmlNode *param_set)
 
enum action_tasks text2task(const char *task)
 
#define CRM_LOG_ASSERT(expr)
 
int(* info)(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
 
#define XML_RSC_OP_T_QUEUE
 
G_GNUC_INTERNAL GList * pcmk__rscs_matching_id(const char *id, pe_working_set_t *data_set)
 
#define pe__set_raw_action_flags(action_flags, action_name, flags_to_set)
 
xmlNode * get_xpath_object(const char *xpath, xmlNode *xml_obj, int error_level)
 
bool pcmk__action_locks_rsc_to_node(const pe_action_t *action)
 
#define pe__set_resource_flags(resource, flags_to_set)
 
void trigger_unfencing(pe_resource_t *rsc, pe_node_t *node, const char *reason, pe_action_t *dependency, pe_working_set_t *data_set)
 
#define CRMD_ACTION_START
 
#define XML_LRM_ATTR_TASK_KEY
 
#define XML_LRM_ATTR_TASK
 
void pcmk__deduplicate_action_inputs(pe_action_t *action)
 
pe_node_t *(* location)(const pe_resource_t *, GList **, int)
 
char * calculate_operation_digest(xmlNode *local_cib, const char *version)
Calculate and return digest of XML operation. 
 
#define crm_warn(fmt, args...)
 
#define CRMD_ACTION_RELOAD_AGENT
 
void pe_action_set_reason(pe_action_t *action, const char *reason, bool overwrite)
 
#define action_type_str(flags)
 
char * pcmk__notify_key(const char *rsc_id, const char *notify_type, const char *op_type)
 
int crm_element_value_ms(const xmlNode *data, const char *name, guint *dest)
Retrieve the millisecond value of an XML attribute. 
 
#define action_node_str(a)
 
#define crm_debug(fmt, args...)
 
pe_resource_t * uber_parent(pe_resource_t *rsc)
 
#define pe_flag_sanitized
 
#define pe__clear_order_flags(order_flags, flags_to_clear)
 
G_GNUC_INTERNAL void pcmk__block_colocated_starts(pe_action_t *action, pe_working_set_t *data_set)
 
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute. 
 
bool pe__is_guest_node(const pe_node_t *node)
 
#define pe_rsc_start_pending
 
#define pe__clear_action_flags(action, flags_to_clear)
 
void pcmk__log_action(const char *pre_text, pe_action_t *action, bool details)
 
#define crm_trace(fmt, args...)
 
enum rsc_digest_cmp_val rc
 
char * digest_secure_calc
 
void calculate_active_ops(GList *sorted_op_list, int *start_index, int *stop_index)
 
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. 
 
struct pe_node_shared_s * details
 
#define crm_log_xml_debug(xml, text)
 
gboolean order_actions(pe_action_t *lh_action, pe_action_t *rh_action, enum pe_ordering order)
 
pe_working_set_t * data_set
 
void pcmk__str_update(char **str, const char *value)
 
#define XML_ATTR_TE_NOWAIT
 
xmlNode * find_rsc_op_entry(pe_resource_t *rsc, const char *key)
 
void(* output_actions)(pe_resource_t *rsc)
 
xmlNode * create_xml_node(xmlNode *parent, const char *name)
 
Action completed, result is known. 
 
#define pe__set_graph_flags(graph_flags, gr_action, flags_to_set)
 
#define XML_LRM_ATTR_MIGRATE_TARGET
 
#define XML_LRM_ATTR_EXIT_REASON
 
#define XML_LRM_ATTR_RESTART_DIGEST
 
void free_xml(xmlNode *child)
 
enum pe_obj_types variant
 
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 CRMD_ACTION_RELOAD
 
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__handle_rsc_config_changes(pe_working_set_t *data_set)
 
pe_node_t * pe_find_node_id(GList *node_list, const char *id)
 
#define XML_ATTR_TRANSITION_KEY
 
#define XML_LRM_ATTR_SECURE_DIGEST
 
#define action_runnable_str(flags)
 
#define action_optional_str(flags)
 
G_GNUC_INTERNAL bool pcmk__rsc_agent_changed(pe_resource_t *rsc, pe_node_t *node, const xmlNode *rsc_entry, bool active_on_node)
 
pcmk__action_result_t result
 
void add_hash_param(GHashTable *hash, const char *name, const char *value)
 
gboolean did_rsc_op_fail(lrmd_event_data_t *event, int target_rc)
 
#define XPATH_NODE_HISTORY
 
#define crm_err(fmt, args...)
 
pe_action_t * pe__clear_failcount(pe_resource_t *rsc, pe_node_t *node, const char *reason, pe_working_set_t *data_set)
Schedule a controller operation to clear a fail count. 
 
op_digest_cache_t * rsc_action_digest_cmp(pe_resource_t *rsc, xmlNode *xml_op, pe_node_t *node, pe_working_set_t *data_set)
 
void lrmd__set_result(lrmd_event_data_t *event, enum ocf_exitcode rc, int op_status, const char *exit_reason)
 
This structure contains everything that makes up a single output formatter. 
 
int compare_version(const char *version1, const char *version2)
 
#define XML_LRM_ATTR_INTERVAL_MS
 
#define XML_LRM_ATTR_CALLID
 
#define CRMD_ACTION_MIGRATE
 
#define pe__clear_resource_flags(resource, flags_to_clear)
 
#define XML_LRM_ATTR_OPSTATUS
 
#define XML_ATTR_CRM_VERSION
 
char * pcmk__transition_key(int transition_id, int action_id, int target_rc, const char *node)
 
enum pe_action_flags flags
 
#define pe_rsc_maintenance
 
pe_working_set_t * cluster
 
const char * pcmk__readable_interval(guint interval_ms)
 
#define XML_LRM_ATTR_TARGET
 
#define XML_LRM_TAG_RSC_OP
 
#define pe_rsc_trace(rsc, fmt, args...)
 
#define pe__set_order_flags(order_flags, flags_to_set)
 
#define XML_LRM_ATTR_MIGRATE_SOURCE
 
#define crm_info(fmt, args...)
 
pe_action_t * find_first_action(GList *input, const char *uuid, const char *task, pe_node_t *on_node)
 
bool pcmk__check_action_config(pe_resource_t *rsc, pe_node_t *node, xmlNode *xml_op)
 
int pe_get_failcount(pe_node_t *node, pe_resource_t *rsc, time_t *last_failure, uint32_t flags, xmlNode *xml_op, pe_working_set_t *data_set)
 
int required_runnable_before
 
pe_action_t * custom_action(pe_resource_t *rsc, char *key, const char *task, pe_node_t *on_node, gboolean optional, gboolean foo, pe_working_set_t *data_set)
Create or update an action object. 
 
#define CRMD_ACTION_STATUS
 
xmlNode * crm_next_same_xml(const xmlNode *sibling)
Get next instance of same XML tag.