25 #define INFINITY_HACK   (INFINITY * -100)    27 #define VARIANT_NATIVE 1    81 #define clear_node_weights_flags(nw_flags, nw_rsc, flags_to_clear) do {     \    82         flags = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE,         \    83                                      "Node weight", (nw_rsc)->id, (flags),  \    84                                      (flags_to_clear), #flags_to_clear);    \   112         best = g_list_nth_data(nodes, 0);
   115     if (prefer && nodes) {
   118         if (chosen == NULL) {
   119             pe_rsc_trace(rsc, 
"Preferred node %s for %s was unknown",
   129             pe_rsc_trace(rsc, 
"Preferred node %s for %s was unsuitable",
   134             pe_rsc_trace(rsc, 
"Preferred node %s for %s was unavailable",
   140                          "Chose preferred node %s for %s (ignoring %d candidates)",
   145     if ((chosen == NULL) && nodes) {
   151         pe_rsc_trace(rsc, 
"Chose node %s for %s from %d candidates",
   154         if (!pe_rsc_is_unique_clone(rsc->
parent)
   165             pe_node_t *running = pe__current_node(rsc);
   168                 pe_rsc_trace(rsc, 
"Current node for %s (%s) can't run resources",
   170             } 
else if (running) {
   171                 for (GList *iter = nodes->next; iter; iter = iter->next) {
   189         static char score[33];
   190         int log_level = (chosen->
weight >= 
INFINITY)? LOG_WARNING : LOG_INFO;
   194                    "Chose node %s for %s from %d nodes with score %s",
   212 best_node_score_matching_attr(
const pe_resource_t *rsc, 
const char *attr,
   218     const char *best_node = NULL;
   222     while (g_hash_table_iter_next(&iter, NULL, (
void **) &node)) {
   227             best_score = node->weight;
   228             best_node = node->details->uname;
   233         if (best_node == NULL) {
   234             crm_info(
"No allowed node for %s matches node attribute %s=%s",
   235                      rsc->
id, attr, value);
   237             crm_info(
"Allowed node %s for %s had best score (%d) "   238                      "of those matching node attribute %s=%s",
   239                      best_node, rsc->
id, best_score, attr, value);
   260 add_node_scores_matching_attr(GHashTable *nodes, 
const pe_resource_t *rsc,
   261                               const char *attr, 
float factor,
   272     g_hash_table_iter_init(&iter, nodes);
   273     while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
   279         score = best_node_score_matching_attr(rsc, attr,
   282         if ((factor < 0) && (score < 0)) {
   288             crm_trace(
"%s: Filtering %d + %f * %d (double negative disallowed)",
   289                       node->details->uname, node->weight, factor, score);
   294             crm_trace(
"%s: Filtering %d + %f * %d (node was marked unusable)",
   295                       node->details->uname, node->weight, factor, score);
   299         weight_f = factor * score;
   302         weight = (int) ((weight_f < 0)? (weight_f - 0.5) : (weight_f + 0.5));
   308         if ((weight == 0) && (score != 0)) {
   311             } 
else if (factor < 0.0) {
   318         if (only_positive && (new_score < 0) && (node->weight > 0)) {
   319             crm_trace(
"%s: Filtering %d + %f * %d = %d "   320                       "(negative disallowed, marking node unusable)",
   321                       node->details->uname, node->weight, factor, score,
   327         if (only_positive && (new_score < 0) && (node->weight == 0)) {
   328             crm_trace(
"%s: Filtering %d + %f * %d = %d (negative disallowed)",
   329                       node->details->uname, node->weight, factor, score,
   334         crm_trace(
"%s: %d + %f * %d = %d", node->details->uname,
   335                   node->weight, factor, score, new_score);
   336         node->weight = new_score;
   363                            GHashTable *nodes, 
const char *attr, 
float factor,
   366     GHashTable *work = NULL;
   370         pe_rsc_info(rsc, 
"%s: Breaking dependency loop at %s",
   371                     primary_id, rsc->
id);
   377         if (is_nonempty_group(rsc)) {
   378             GList *last = g_list_last(rsc->
children);
   382                          "using last member %s (at %.6f)",
   383                          primary_id, rsc->
id, last_rsc->
id, factor);
   391     } 
else if (is_nonempty_group(rsc)) {
   402         pe_rsc_trace(rsc, 
"%s: Merging scores from first member of group %s "   403                      "(at %.6f)", primary_id, rsc->
id, factor);
   406                                           attr, factor, 
flags);
   409         pe_rsc_trace(rsc, 
"%s: Merging scores from %s (at %.6f)",
   410                      primary_id, rsc->
id, factor);
   412         add_node_scores_matching_attr(work, rsc, attr, factor,
   418         int multiplier = (factor < 0)? -1 : 1;
   423                          "Checking additional %d optional '%s with' constraints",
   424                          g_list_length(gIter), rsc->
id);
   426         } 
else if (is_nonempty_group(rsc)) {
   430             pe_rsc_trace(rsc, 
"Checking additional %d optional 'with group %s' "   431                          "constraints using last member %s",
   432                          g_list_length(gIter), rsc->
id, last_rsc->
id);
   437                          "Checking additional %d optional 'with %s' constraints",
   438                          g_list_length(gIter), rsc->
id);
   441         for (; gIter != NULL; gIter = gIter->next) {
   447             } 
else if (!pcmk__colocation_has_influence(constraint, NULL)) {
   453             pe_rsc_trace(rsc, 
"Optionally merging score of '%s' constraint (%s with %s)",
   464         pe_rsc_info(rsc, 
"%s: Rolling back optional scores from %s",
   465                     primary_id, rsc->
id);
   466         g_hash_table_destroy(work);
   476         g_hash_table_iter_init(&iter, work);
   477         while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
   485         g_hash_table_destroy(nodes);
   500         pe_rsc_debug(rsc, 
"Escalating allocation of %s to its parent: %s", rsc->
id,
   510         pe_rsc_debug(rsc, 
"Dependency loop detected involving %s", rsc->
id);
   517     for (gIter = rsc->
rsc_cons; gIter != NULL; gIter = gIter->next) {
   520         GHashTable *archive = NULL;
   529                      "%s: Allocating %s first (constraint=%s score=%d role=%s)",
   530                      rsc->
id, primary->id, constraint->
id,
   532         primary->cmds->allocate(primary, NULL, 
data_set);
   535             pe_rsc_info(rsc, 
"%s: Rolling back scores from %s",
   536                         rsc->
id, primary->id);
   542             g_hash_table_destroy(archive);
   548     for (gIter = rsc->
rsc_cons_lhs; gIter != NULL; gIter = gIter->next) {
   551         if (!pcmk__colocation_has_influence(constraint, NULL)) {
   554         pe_rsc_trace(rsc, 
"Merging score of '%s' constraint (%s with %s)",
   564         pe_rsc_trace(rsc, 
"Making sure %s doesn't get allocated", rsc->
id);
   571         crm_notice(
"Resource %s cannot be elevated from %s to %s: no-quorum-policy=freeze",
   584         const char *reason = NULL;
   588         assign_to = pe__current_node(rsc);
   589         if (assign_to == NULL) {
   598         pe_rsc_info(rsc, 
"Unmanaged resource %s allocated to %s: %s", rsc->
id,
   599                     (assign_to? assign_to->
details->
uname : 
"no node"), reason);
   607                && native_choose_node(rsc, prefer, 
data_set)) {
   613             pe_rsc_info(rsc, 
"Resource %s cannot run anywhere", rsc->
id);
   630             crm_trace(
"Setting Pacemaker Remote node %s to ONLINE",
   640             crm_trace(
"Setting Pacemaker Remote node %s to SHUTDOWN (next role %s, %sallocated)",
   653     gboolean dup = FALSE;
   654     const char *
id = NULL;
   655     const char *value = NULL;
   656     xmlNode *operation = NULL;
   657     guint interval2_ms = 0;
   660     for (operation = pcmk__xe_first_child(rsc->
ops_xml); operation != NULL;
   661          operation = pcmk__xe_next(operation)) {
   663         if (pcmk__str_eq((
const char *)operation->name, 
"op", 
pcmk__str_none)) {
   671             if (interval_ms != interval2_ms) {
   680                                  "same name and interval combination more "   681                                  "than once per resource)", 
ID(operation), 
id);
   691 op_cannot_recur(
const char *
name)
   701     const char *
name = NULL;
   702     const char *role = NULL;
   703     const char *interval_spec = NULL;
   704     const char *node_uname = node? node->
details->
uname : 
"n/a";
   706     guint interval_ms = 0;
   708     gboolean is_optional = TRUE;
   709     GList *possible_matches = NULL;
   721     if (interval_ms == 0) {
   726     if (is_op_dup(rsc, 
name, interval_ms)) {
   727         crm_trace(
"Not creating duplicate recurring action %s for %dms %s",
   728                   ID(operation), interval_ms, 
name);
   732     if (op_cannot_recur(
name)) {
   740         crm_trace(
"Not creating recurring action %s for disabled resource %s",
   741                   ID(operation), rsc->
id);
   746     pe_rsc_trace(rsc, 
"Creating recurring action %s for %s in role %s on %s",
   761     if (possible_matches == NULL) {
   763         pe_rsc_trace(rsc, 
"Marking %s mandatory: not active", key);
   768         for (gIter = possible_matches; gIter != NULL; gIter = gIter->next) {
   776         g_list_free(possible_matches);
   782         const char *
result = 
"Ignoring";
   785             char *after_key = NULL;
   789             log_level = LOG_INFO;
   817         do_crm_log(log_level, 
"%s action %s (%s vs. %s)",
   832         pe_rsc_debug(rsc, 
"%s\t   %s (cancelled : start un-runnable)",
   833                      node_uname, mon->
uuid);
   837         pe_rsc_debug(rsc, 
"%s\t   %s (cancelled : no node available)",
   838                      node_uname, mon->
uuid);
   842         pe_rsc_info(rsc, 
" Start recurring %s (%us) for %s on %s",
   843                     mon->
task, interval_ms / 1000, rsc->
id, node_uname);
   850         free(running_promoted);
   880         xmlNode *operation = NULL;
   882         for (operation = pcmk__xe_first_child(rsc->
ops_xml);
   884              operation = pcmk__xe_next(operation)) {
   886             if (pcmk__str_eq((
const char *)operation->name, 
"op", 
pcmk__str_none)) {
   887                 RecurringOp(rsc, start, node, operation, 
data_set);
   898     const char *
name = NULL;
   899     const char *role = NULL;
   900     const char *interval_spec = NULL;
   901     const char *node_uname = node? node->
details->
uname : 
"n/a";
   903     guint interval_ms = 0;
   904     GList *possible_matches = NULL;
   915     if (interval_ms == 0) {
   920     if (is_op_dup(rsc, 
name, interval_ms)) {
   921         crm_trace(
"Not creating duplicate recurring action %s for %dms %s",
   922                   ID(operation), interval_ms, 
name);
   926     if (op_cannot_recur(
name)) {
   934         crm_trace(
"Not creating recurring action %s for disabled resource %s",
   935                   ID(operation), rsc->
id);
   942         crm_notice(
"Ignoring %s (recurring monitors for Stopped role are "   943                    "not supported for anonymous clones)",
   949                  "Creating recurring action %s for %s in role %s on nodes where it should not be running",
   955         if (possible_matches) {
   958             g_list_free(possible_matches);
   970             pe_rsc_info(rsc, 
"Cancel action %s (%s vs. %s) on %s",
   975     for (gIter = 
data_set->
nodes; gIter != NULL; gIter = gIter->next) {
   977         const char *stop_node_uname = stop_node->
details->
uname;
   978         gboolean is_optional = TRUE;
   979         gboolean probe_is_optional = TRUE;
   980         gboolean stop_is_optional = TRUE;
   982         char *rc_inactive = NULL;
   983         GList *stop_ops = NULL;
   984         GList *local_gIter = NULL;
   986         if (node && pcmk__str_eq(stop_node_uname, node_uname, 
pcmk__str_casei)) {
   990         pe_rsc_trace(rsc, 
"Creating recurring action %s for %s on %s",
   995         if (possible_matches == NULL) {
   996             pe_rsc_trace(rsc, 
"Marking %s mandatory on %s: not active", key,
  1000             pe_rsc_trace(rsc, 
"Marking %s optional on %s: already active", key,
  1003             g_list_free(possible_matches);
  1015             GList *pIter = NULL;
  1017             for (pIter = probes; pIter != NULL; pIter = pIter->next) {
  1024             g_list_free(probes);
  1029         for (local_gIter = stop_ops; local_gIter != NULL; local_gIter = local_gIter->next) {
  1033                 stop_is_optional = FALSE;
  1037                 crm_debug(
"%s\t   %s (cancelled : stop un-runnable)",
  1038                           crm_str(stop_node_uname), stopped_mon->uuid);
  1052             g_list_free(stop_ops);
  1055         if (is_optional == FALSE && probe_is_optional && stop_is_optional
  1057             pe_rsc_trace(rsc, 
"Marking %s optional on %s due to unmanaged",
  1058                          key, 
crm_str(stop_node_uname));
  1067             pe_rsc_debug(rsc, 
"%s\t   %s (cancelled : no node available)",
  1068                          crm_str(stop_node_uname), stopped_mon->uuid);
  1074             crm_notice(
" Start recurring %s (%us) for %s on %s", stopped_mon->task,
  1075                        interval_ms / 1000, rsc->
id, 
crm_str(stop_node_uname));
  1087         xmlNode *operation = NULL;
  1089         for (operation = pcmk__xe_first_child(rsc->
ops_xml);
  1091              operation = pcmk__xe_next(operation)) {
  1093             if (pcmk__str_eq((
const char *)operation->name, 
"op", 
pcmk__str_none)) {
  1094                 RecurringOp_Stopped(rsc, start, node, operation, 
data_set);
  1109     pe_rsc_trace(rsc, 
"Processing migration actions %s moving from %s to %s . partial migration = %s",
  1114     if (partial == FALSE) {
  1122     if ((migrate_to && migrate_from) || (migrate_from && partial)) {
  1202                          pe_node_t *chosen, 
bool need_stop, 
bool need_promote)
  1212         pe_rsc_trace(rsc, 
"Creating %s action to take %s down from %s to %s",
  1213                      (need_stop? 
"required" : 
"optional"), rsc->
id,
  1215         if (!rsc_action_matrix[role][next_role](rsc, current, !need_stop,
  1225         bool required = need_stop;
  1227         next_role = rsc_state_matrix[role][rsc->
role];
  1231         pe_rsc_trace(rsc, 
"Creating %s action to take %s up from %s to %s",
  1232                      (required? 
"required" : 
"optional"), rsc->
id,
  1234         if (!rsc_action_matrix[role][next_role](rsc, chosen, !required,
  1250     gboolean need_stop = FALSE;
  1251     bool need_promote = FALSE;
  1252     gboolean is_moving = FALSE;
  1253     gboolean allow_migrate = FALSE;
  1255     GList *gIter = NULL;
  1256     unsigned int num_all_active = 0;
  1257     unsigned int num_clean_active = 0;
  1258     bool multiply_active = FALSE;
  1272     pe_rsc_trace(rsc, 
"Creating all actions for %s transition from %s to %s (%s) on %s",
  1275                  ((chosen == NULL)? 
"no node" : chosen->
details->
uname));
  1284         pe_rsc_trace(rsc, 
"Creating stop action %sfor %s on %s due to dangling migration",
  1294     if ((num_all_active == 2) && (num_clean_active == 2) && chosen
  1303         pe_rsc_trace(rsc, 
"Will attempt to continue with partial migration "  1304                      "to target %s from %s",
  1316         multiply_active = (num_clean_active > 1);
  1318         multiply_active = (num_all_active > 1);
  1321     if (multiply_active) {
  1324             crm_notice(
"Resource %s can no longer migrate from %s to %s "  1325                        "(will stop on both nodes)",
  1328             multiply_active = 
false;
  1334             pe_proc_err(
"%s resource %s might be active on %u nodes (%s)",
  1335                         crm_str(
class), rsc->id, num_all_active,
  1336                         recovery2text(rsc->recovery_type));
  1337             crm_notice(
"See https://wiki.clusterlabs.org/wiki/FAQ#Resource_is_Too_Active for more information");
  1356         allow_migrate = FALSE;
  1359     if (!multiply_active) {
  1364         pe_rsc_trace(rsc, 
"Creating start action for %s to represent already pending start",
  1384                 need_promote = TRUE;
  1393         pe_rsc_trace(rsc, 
"Creating start action for promoted resource %s",
  1398             pe_rsc_trace(rsc, 
"%s restart is required for recovery", rsc->
id);
  1406     schedule_restart_actions(rsc, current, chosen, need_stop, need_promote);
  1411         next_role = rsc_state_matrix[role][rsc->
next_role];
  1412         pe_rsc_trace(rsc, 
"Creating action to take %s from %s to %s (ending at %s)",
  1415         if (rsc_action_matrix[role][next_role] (rsc, chosen, FALSE, 
data_set) == FALSE) {
  1422         pe_rsc_trace(rsc, 
"Not creating recurring monitors for blocked resource %s",
  1427         pe_rsc_trace(rsc, 
"Creating recurring monitors for %s resource %s",
  1431         Recurring(rsc, start, chosen, 
data_set);
  1432         Recurring_Stopped(rsc, start, chosen, 
data_set);
  1435         pe_rsc_trace(rsc, 
"Creating recurring monitors for inactive resource %s",
  1437         Recurring_Stopped(rsc, NULL, NULL, 
data_set);
  1444         pe_rsc_trace(rsc, 
"Not allowing partial migration of %s to continue",
  1446         allow_migrate = FALSE;
  1449                || pcmk_any_flags_set(rsc->
flags,
  1454         allow_migrate = FALSE;
  1457     if (allow_migrate) {
  1458         handle_migration_actions(rsc, current, chosen, 
data_set);
  1465     GHashTableIter iter;
  1468     while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
  1469         if (node->details->remote_rsc) {
  1492     GList *allowed_nodes = NULL;
  1495         allowed_nodes = g_hash_table_get_values(rsc->
allowed_nodes);
  1502     return allowed_nodes;
  1511     GList *allowed_nodes = NULL;
  1512     bool check_unfencing = FALSE;
  1513     bool check_utilization = 
false;
  1517                      "Skipping native constraints for unmanaged resource: %s",
  1530     check_utilization = (g_hash_table_size(rsc->
utilization) > 0)
  1560     if (check_unfencing || check_utilization || rsc->
container) {
  1561         allowed_nodes = allowed_nodes_as_list(rsc, 
data_set);
  1564     if (check_unfencing) {
  1567         for (GList *item = allowed_nodes; item; item = item->next) {
  1571             crm_debug(
"Ordering any stops of %s before %s, and any starts after",
  1590                                NULL, strdup(unfence->
uuid), unfence,
  1600     if (check_utilization) {
  1615                 rsc_avoids_remote_nodes(rsc->
container);
  1645             for (GList *item = allowed_nodes; item; item = item->next) {
  1660             crm_trace(
"Order and colocate %s relative to its container %s",
  1688         rsc_avoids_remote_nodes(rsc);
  1690     g_list_free(allowed_nodes);
  1698     if (dependent == NULL) {
  1699         pe_err(
"dependent was NULL for %s", constraint->
id);
  1702     } 
else if (constraint->
primary == NULL) {
  1703         pe_err(
"primary was NULL for %s", constraint->
id);
  1708                  "Processing colocation constraint between %s and %s",
  1709                  dependent->
id, primary->
id);
  1721     CRM_ASSERT((dependent != NULL) && (primary != NULL));
  1724     pe_rsc_trace(dependent, 
"%s %s with %s (%s, score=%d, filter=%d)",
  1725                  ((constraint->
score > 0)? 
"Colocating" : 
"Anti-colocating"),
  1726                  dependent->
id, primary->
id, constraint->
id, constraint->
score,
  1729     switch (filter_results) {
  1762 #define clear_action_flag_because(action, flag, reason) do {                \  1763         if (pcmk_is_set((action)->flags, (flag))) {                         \  1764             pe__clear_action_flags(action, flag);                           \  1765             if ((action)->rsc != (reason)->rsc) {                           \  1766                 char *reason_text = pe__action2reason((reason), (flag));    \  1767                 pe_action_set_reason((action), reason_text,                 \  1768                                    ((flag) == pe_action_migrate_runnable)); \  1769                 free(reason_text);                                          \  1789     const char *reason = NULL;
  1808         && (first->
rsc == then->
rsc)) {
  1812     if (reason == NULL) {
  1954         handle_restart_ordering(first, then, filter);
  1957     if (then_flags != then->
flags) {
  1960                      "%s on %s: flags are now %#.6x (was %#.6x) "  1961                      "because of 'first' %s (%#.6x)",
  1972     if (first_flags != first->
flags) {
  1975                      "%s on %s: flags are now %#.6x (was %#.6x) "  1976                      "because of 'then' %s (%#.6x)",
  1994     GList *gIter = NULL;
  1999     for (gIter = rsc->
actions; gIter != NULL; gIter = gIter->next) {
  2006     for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
  2029     return pcmk_all_flags_set(rsc->
flags,
  2039     GList *gIter = NULL;
  2043     for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
  2047         if (is_expected_node(rsc, current)) {
  2053                          "Skipping stop of multiply active resource %s "  2054                          "on expected node %s",
  2062                              "Skipping stop of %s on %s "  2063                              "because migration to %s in progress",
  2069                              "Forcing stop of %s on %s "  2070                              "because migration target changed",
  2119     pe_rsc_trace(rsc, 
"Scheduling %s start of %s on %s (weight=%d)",
  2120                  (optional? 
"optional" : 
"required"), rsc->
id,
  2122                  ((next == NULL)? 0 : next->
weight));
  2131     if (is_expected_node(rsc, next)) {
  2136                      "Start of multiply active resouce %s "  2137                      "on expected node %s will be a pseudo-action",
  2148     GList *gIter = NULL;
  2149     gboolean runnable = TRUE;
  2150     GList *action_list = NULL;
  2159     for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
  2166     g_list_free(action_list);
  2171         if (is_expected_node(rsc, next)) {
  2176                          "Promotion of multiply active resouce %s "  2177                          "on expected node %s will be a pseudo-action",
  2189     for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
  2195     g_list_free(action_list);
  2202     GList *gIter = NULL;
  2206     if (is_expected_node(rsc, next)) {
  2208                      "Skipping demote of multiply active resource %s "  2209                      "on expected node %s",
  2217     for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
  2250     } 
else if (node == NULL) {
  2251         pe_rsc_trace(rsc, 
"Resource %s not deleted: NULL node", rsc->
id);
  2255         pe_rsc_trace(rsc, 
"Resource %s not deleted from %s: unrunnable", rsc->
id,
  2286     static const char *rc_promoted = NULL;
  2287     static const char *rc_inactive = NULL;
  2289     if (rc_inactive == NULL) {
  2296         pe_rsc_trace(rsc, 
"Skipping active resource detection for %s", rsc->
id);
  2305                          "Skipping probe for %s on %s because Pacemaker Remote nodes cannot run stonith agents",
  2311                          "Skipping probe for %s on %s because guest nodes cannot run resources containing guest nodes",
  2314         } 
else if (rsc->is_remote_node) {
  2316                          "Skipping probe for %s on %s because Pacemaker Remote nodes cannot host remote connections",
  2323         GList *gIter = NULL;
  2324         gboolean any_created = FALSE;
  2326         for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
  2354         if (allowed == NULL) {
  2415             pe_rsc_trace(rsc, 
"Skipping probe for %s on node %s, %s is stopped",
  2436         pe_rsc_trace(rsc, 
"Skipping probe for %s on node %s, %s is stopping, restarting or moving",
  2456     if (running == NULL) {
  2524                                 GList *all_rscs, GHashTable *utilization)
  2530     pe_rsc_trace(orig_rsc, 
"%s: Adding primitive %s as colocated utilization",
  2531                  orig_rsc->
id, rsc->
id);
  2550     if (shutdown != NULL) {
  2551         long long result_ll;
  2554             result = (time_t) result_ll;
  2572     if (rsc->lock_node != NULL) {
  2575         if (rsc->running_on != NULL) {
  2581                         "Cancelling shutdown lock because %s is already active",
  2584             rsc->lock_node = NULL;
  2589     } 
else if (pcmk__list_of_1(rsc->running_on)) {
  2590         pe_node_t *node = rsc->running_on->data;
  2594                 pe_rsc_debug(rsc, 
"Not locking %s to unclean %s for shutdown",
  2597                 rsc->lock_node = node;
  2598                 rsc->lock_time = shutdown_time(node, rsc->cluster);
  2603     if (rsc->lock_node == NULL) {
  2608     if (rsc->cluster->shutdown_lock > 0) {
  2609         time_t lock_expiration = rsc->lock_time + rsc->cluster->shutdown_lock;
  2611         pe_rsc_info(rsc, 
"Locking %s to %s due to shutdown (expires @%lld)",
  2612                     rsc->id, rsc->lock_node->details->uname,
  2613                     (
long long) lock_expiration);
  2616         pe_rsc_info(rsc, 
"Locking %s to %s due to shutdown",
  2617                     rsc->id, rsc->lock_node->details->uname);
  2621     for (GList *item = rsc->cluster->nodes; item != NULL; item = item->next) {
  2624         if (strcmp(node->
details->
uname, rsc->lock_node->details->uname)) {
 
#define CRM_CHECK(expr, failure_action)
pe_node_t * pe_find_node(GList *node_list, const char *uname)
enum rsc_start_requirement needs
enum pe_quorum_policy no_quorum_policy
void native_rsc_colocation_rh(pe_resource_t *dependent, pe_resource_t *primary, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
#define crm_notice(fmt, args...)
bool pe__is_guest_or_remote_node(const pe_node_t *node)
#define pe_rsc_debug(rsc, fmt, args...)
#define XML_CONFIG_ATTR_SHUTDOWN_LOCK
Service active and promoted. 
#define pe__set_action_flags(action, flags_to_set)
#define pe__show_node_weights(level, rsc, text, nodes, data_set)
#define promote_action(rsc, node, optional)
G_GNUC_INTERNAL bool pcmk__node_unfenced(pe_node_t *node)
#define stop_action(rsc, node, optional)
pe_node_t * pe__find_active_on(const pe_resource_t *rsc, unsigned int *count_all, unsigned int *count_clean)
pe_resource_t * container
bool pcmk__strcase_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
pe_node_t * partial_migration_source
G_GNUC_INTERNAL bool pcmk__node_available(const pe_node_t *node)
void pe__update_recheck_time(time_t recheck, pe_working_set_t *data_set)
G_GNUC_INTERNAL bool pcmk__any_node_available(GHashTable *nodes)
gboolean PromoteRsc(pe_resource_t *rsc, pe_node_t *next, gboolean optional, pe_working_set_t *data_set)
resource_alloc_functions_t * cmds
#define delete_action(rsc, node, optional)
#define pe_flag_remove_after_stop
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)
#define XML_RSC_ATTR_INCARNATION
enum rsc_role_e next_role
gboolean exclusive_discover
#define pcmk__config_err(fmt...)
gboolean StartRsc(pe_resource_t *rsc, pe_node_t *next, gboolean optional, pe_working_set_t *data_set)
pe_resource_t * remote_rsc
#define pe_rsc_restarting
char * score2char_stack(int score, char *buf, size_t len)
Convert an integer score to a string, using a provided buffer. 
resource_object_functions_t * fns
#define clear_node_weights_flags(nw_flags, nw_rsc, flags_to_clear)
#define XML_LRM_ATTR_INTERVAL
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value. 
pe_resource_t * dependent
enum pe_graph_flags native_update_actions(pe_action_t *first, pe_action_t *then, pe_node_t *node, enum pe_action_flags flags, enum pe_action_flags filter, enum pe_ordering type, pe_working_set_t *data_set)
time_t get_effective_time(pe_working_set_t *data_set)
void resource_location(pe_resource_t *rsc, pe_node_t *node, int score, const char *tag, pe_working_set_t *data_set)
enum crm_ais_msg_types type
pe_node_t * partial_migration_target
pe_node_t *(* allocate)(pe_resource_t *, pe_node_t *, pe_working_set_t *)
#define pe_rsc_stop_unexpected
gboolean RoleError(pe_resource_t *rsc, pe_node_t *next, gboolean optional, pe_working_set_t *data_set)
#define pe_rsc_allow_remote_remotes
#define pe_flag_have_quorum
#define CRM_SCORE_INFINITY
G_GNUC_INTERNAL void pcmk__apply_coloc_to_priority(pe_resource_t *dependent, pe_resource_t *primary, pcmk__colocation_t *constraint)
#define pe_proc_err(fmt...)
gboolean remote_requires_reset
char * crm_meta_name(const char *field)
G_GNUC_INTERNAL void pcmk__new_colocation(const char *id, const char *node_attr, int score, pe_resource_t *dependent, pe_resource_t *primary, const char *dependent_role, const char *primary_role, bool influence, pe_working_set_t *data_set)
#define pe__set_resource_flags(resource, flags_to_set)
G_GNUC_INTERNAL void pcmk__create_utilization_constraints(pe_resource_t *rsc, GList *allowed_nodes)
#define clear_action_flag_because(action, flag, reason)
#define pe_flag_stop_everything
G_GNUC_INTERNAL pe_action_t * pcmk__new_cancel_action(pe_resource_t *rsc, const char *name, guint interval_ms, pe_node_t *node)
#define demote_action(rsc, node, optional)
#define pe_rsc_provisional
const char * role2text(enum rsc_role_e role)
int pcmk__scan_ll(const char *text, long long *result, long long default_value)
GList * dangling_migrations
void pe_action_set_reason(pe_action_t *action, const char *reason, bool overwrite)
gboolean(* create_probe)(pe_resource_t *, pe_node_t *, pe_action_t *, gboolean, pe_working_set_t *)
gboolean DemoteRsc(pe_resource_t *rsc, pe_node_t *next, gboolean optional, pe_working_set_t *data_set)
#define pe_rsc_allow_migrate
#define crm_debug(fmt, args...)
void native_expand(pe_resource_t *rsc, pe_working_set_t *data_set)
gboolean(* rsc_transition_fn)(pe_resource_t *rsc, pe_node_t *next, gboolean optional, pe_working_set_t *data_set)
G_GNUC_INTERNAL GList * pcmk__sort_nodes(GList *nodes, pe_node_t *active_node, pe_working_set_t *data_set)
pe_resource_t * uber_parent(pe_resource_t *rsc)
#define XML_CIB_ATTR_SHUTDOWN
pe_resource_t * pe__resource_contains_guest_node(const pe_working_set_t *data_set, const pe_resource_t *rsc)
#define XML_RSC_ATTR_CONTAINER
void native_internal_constraints(pe_resource_t *rsc, 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)
void(* rsc_colocation_lh)(pe_resource_t *, pe_resource_t *, pcmk__colocation_t *, pe_working_set_t *)
void native_append_meta(pe_resource_t *rsc, xmlNode *xml)
#define pe_rsc_start_pending
#define pe__clear_action_flags(action, flags_to_clear)
#define crm_trace(fmt, args...)
#define do_crm_log(level, fmt, args...)
Log a message. 
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag. 
struct pe_node_shared_s * details
enum rsc_recovery_type recovery_type
#define pe_rsc_needs_fencing
gboolean order_actions(pe_action_t *lh_action, pe_action_t *rh_action, enum pe_ordering order)
#define pe_rsc_promotable
void(* expand)(pe_resource_t *, pe_working_set_t *)
pe_working_set_t * data_set
#define pcmk__order_resource_actions(lh_rsc, lh_task, rh_rsc, rh_task, flags, data_set)
xmlNode * find_rsc_op_entry(pe_resource_t *rsc, const char *key)
#define pe_flag_stonith_enabled
const char * pe_node_attribute_raw(pe_node_t *node, const char *name)
#define pe__set_graph_flags(graph_flags, gr_action, flags_to_set)
#define XML_RSC_ATTR_TARGET_ROLE
#define XML_LRM_ATTR_MIGRATE_TARGET
#define XML_RSC_ATTR_REMOTE_NODE
void(* rsc_colocation_rh)(pe_resource_t *, pe_resource_t *, pcmk__colocation_t *, pe_working_set_t *)
enum pe_action_flags(* action_flags)(pe_action_t *, pe_node_t *)
#define pe_rsc_allocating
enum rsc_role_e text2role(const char *role)
enum pe_obj_types variant
void native_rsc_location(pe_resource_t *rsc, pe__location_t *constraint)
const char * placement_strategy
char * pcmk__op_key(const char *rsc_id, const char *op_type, guint interval_ms)
Generate an operation key (RESOURCE_ACTION_INTERVAL) 
G_GNUC_INTERNAL void pcmk__add_action_to_graph(pe_action_t *action, pe_working_set_t *data_set)
#define pe_rsc_fence_device
pe_node_t * pe_find_node_id(GList *node_list, const char *id)
void native_rsc_colocation_lh(pe_resource_t *dependent, pe_resource_t *primary, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
#define PCMK_RESOURCE_CLASS_STONITH
enum pe_action_flags native_action_flags(pe_action_t *action, pe_node_t *node)
enum rsc_role_e(* state)(const pe_resource_t *, gboolean)
G_GNUC_INTERNAL void pcmk__update_action_for_orderings(pe_action_t *action, pe_working_set_t *data_set)
pcmk__action_result_t result
void add_hash_param(GHashTable *hash, const char *name, const char *value)
G_GNUC_INTERNAL bool pcmk__assign_primitive(pe_resource_t *rsc, pe_node_t *chosen, bool force)
#define start_action(rsc, node, optional)
G_GNUC_INTERNAL void pcmk__release_node_capacity(GHashTable *current_utilization, pe_resource_t *rsc)
G_GNUC_INTERNAL GHashTable * pcmk__copy_node_table(GHashTable *nodes)
#define crm_err(fmt, args...)
G_GNUC_INTERNAL void pcmk__order_vs_unfence(pe_resource_t *rsc, pe_node_t *node, pe_action_t *action, enum pe_ordering order, pe_working_set_t *data_set)
void pcmk__primitive_add_utilization(pe_resource_t *rsc, pe_resource_t *orig_rsc, GList *all_rscs, GHashTable *utilization)
char guint crm_parse_interval_spec(const char *input)
Parse milliseconds from a Pacemaker interval specification. 
G_GNUC_INTERNAL void pcmk__ban_insufficient_capacity(pe_resource_t *rsc, pe_node_t **prefer, pe_working_set_t *data_set)
void pe__set_next_role(pe_resource_t *rsc, enum rsc_role_e role, const char *why)
gboolean StopRsc(pe_resource_t *rsc, pe_node_t *next, gboolean optional, pe_working_set_t *data_set)
void pcmk__primitive_shutdown_lock(pe_resource_t *rsc)
pe_node_t * pcmk__native_allocate(pe_resource_t *rsc, pe_node_t *prefer, pe_working_set_t *data_set)
#define pe_rsc_needs_unfencing
void native_create_actions(pe_resource_t *rsc, pe_working_set_t *data_set)
#define pe__clear_resource_flags(resource, flags_to_clear)
rsc_role_e
Possible roles that a resource can be in. 
enum pe_action_flags flags
#define pe_rsc_maintenance
pe_working_set_t * cluster
const char * node_attribute
int pcmk__add_scores(int score1, int score2)
#define XML_OP_ATTR_PENDING
gboolean DeleteRsc(pe_resource_t *rsc, pe_node_t *node, gboolean optional, pe_working_set_t *data_set)
bool pe__resource_is_remote_conn(const pe_resource_t *rsc, const pe_working_set_t *data_set)
#define pe_flag_have_stonith_resource
G_GNUC_INTERNAL enum pcmk__coloc_affects pcmk__colocation_affects(pe_resource_t *dependent, pe_resource_t *primary, pcmk__colocation_t *constraint, bool preview)
GList * find_actions_exact(GList *input, const char *key, const pe_node_t *on_node)
#define pe_flag_enable_unfencing
#define pe_rsc_trace(rsc, fmt, args...)
G_GNUC_INTERNAL void pcmk__apply_coloc_to_weights(pe_resource_t *dependent, pe_resource_t *primary, pcmk__colocation_t *constraint)
#define pe__set_order_flags(order_flags, flags_to_set)
GList * pe__resource_actions(const pe_resource_t *rsc, const pe_node_t *node, const char *task, bool require_node)
Find all actions of given type for a resource. 
pe_action_t * pe__clear_resource_history(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set)
#define XML_LRM_ATTR_MIGRATE_SOURCE
gboolean native_create_probe(pe_resource_t *rsc, pe_node_t *node, pe_action_t *complete, gboolean force, pe_working_set_t *data_set)
#define CRM_OP_LRM_DELETE
gint sort_node_uname(gconstpointer a, gconstpointer b)
#define pe_flag_show_scores
#define crm_info(fmt, args...)
G_GNUC_INTERNAL void pcmk__apply_location(pe__location_t *constraint, pe_resource_t *rsc)
#define XML_ATTR_TE_TARGET_RC
G_GNUC_INTERNAL bool pcmk__is_unfence_device(const pe_resource_t *rsc, const pe_working_set_t *data_set)
pe_action_t * pe_fence_op(pe_node_t *node, const char *op, bool optional, const char *reason, bool priority_delay, pe_working_set_t *data_set)
GHashTable * pcmk__native_merge_weights(pe_resource_t *rsc, const char *primary_id, GHashTable *nodes, const char *attr, float factor, uint32_t flags)
GHashTable *(* merge_weights)(pe_resource_t *, const char *, GHashTable *, const char *, float, enum pe_weights)
#define pe_rsc_info(rsc, fmt, args...)
gboolean NullOp(pe_resource_t *rsc, pe_node_t *next, gboolean optional, pe_working_set_t *data_set)
#define XML_AGENT_ATTR_CLASS
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. 
GHashTable * allowed_nodes
#define pe_flag_startup_probes