23 #define INFINITY_HACK (INFINITY * -100)
25 #define VARIANT_NATIVE 1
80 #define clear_node_weights_flags(nw_flags, nw_rsc, flags_to_clear) do { \
81 flags = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, \
82 "Node weight", (nw_rsc)->id, (flags), \
83 (flags_to_clear), #flags_to_clear); \
94 gboolean result = FALSE;
111 best = g_list_nth_data(nodes, 0);
114 if (prefer && nodes) {
117 if (chosen == NULL) {
118 pe_rsc_trace(rsc,
"Preferred node %s for %s was unknown",
128 pe_rsc_trace(rsc,
"Preferred node %s for %s was unsuitable",
133 pe_rsc_trace(rsc,
"Preferred node %s for %s was unavailable",
139 "Chose preferred node %s for %s (ignoring %d candidates)",
144 if ((chosen == NULL) && nodes) {
150 pe_rsc_trace(rsc,
"Chose node %s for %s from %d candidates",
153 if (!pe_rsc_is_unique_clone(rsc->
parent)
164 pe_node_t *running = pe__current_node(rsc);
167 pe_rsc_trace(rsc,
"Current node for %s (%s) can't run resources",
169 }
else if (running) {
170 for (GList *iter = nodes->next; iter; iter = iter->next) {
188 static char score[33];
189 int log_level = (chosen->
weight >=
INFINITY)? LOG_WARNING : LOG_INFO;
193 "Chose node %s for %s from %d nodes with score %s",
211 best_node_score_matching_attr(
const pe_resource_t *rsc,
const char *attr,
217 const char *best_node = NULL;
221 while (g_hash_table_iter_next(&iter, NULL, (
void **) &node)) {
226 best_score = node->
weight;
232 if (best_node == NULL) {
233 crm_info(
"No allowed node for %s matches node attribute %s=%s",
234 rsc->
id, attr, value);
236 crm_info(
"Allowed node %s for %s had best score (%d) "
237 "of those matching node attribute %s=%s",
238 best_node, rsc->
id, best_score, attr, value);
259 add_node_scores_matching_attr(GHashTable *nodes,
const pe_resource_t *rsc,
260 const char *attr,
float factor,
271 g_hash_table_iter_init(&iter, nodes);
272 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
278 score = best_node_score_matching_attr(rsc, attr,
281 if ((factor < 0) && (score < 0)) {
287 crm_trace(
"%s: Filtering %d + %f * %d (double negative disallowed)",
293 crm_trace(
"%s: Filtering %d + %f * %d (node was marked unusable)",
298 weight_f = factor * score;
301 weight = (int) ((weight_f < 0)? (weight_f - 0.5) : (weight_f + 0.5));
307 if ((weight == 0) && (score != 0)) {
310 }
else if (factor < 0.0) {
317 if (only_positive && (new_score < 0) && (node->
weight > 0)) {
318 crm_trace(
"%s: Filtering %d + %f * %d = %d "
319 "(negative disallowed, marking node unusable)",
326 if (only_positive && (new_score < 0) && (node->
weight == 0)) {
327 crm_trace(
"%s: Filtering %d + %f * %d = %d (negative disallowed)",
334 node->
weight, factor, score, new_score);
362 GHashTable *nodes,
const char *attr,
float factor,
365 GHashTable *work = NULL;
369 pe_rsc_info(rsc,
"%s: Breaking dependency loop at %s", rhs, rsc->
id);
375 if (is_nonempty_group(rsc)) {
376 GList *last = g_list_last(rsc->
children);
380 "using last member %s (at %.6f)",
381 rhs, rsc->
id, last_rsc->
id, factor);
389 }
else if (is_nonempty_group(rsc)) {
400 pe_rsc_trace(rsc,
"%s: Merging scores from first member of group %s "
401 "(at %.6f)", rhs, rsc->
id, factor);
407 pe_rsc_trace(rsc,
"%s: Merging scores from %s (at %.6f)",
408 rhs, rsc->
id, factor);
410 add_node_scores_matching_attr(work, rsc, attr, factor,
416 int multiplier = (factor < 0)? -1 : 1;
421 "Checking additional %d optional '%s with' constraints",
422 g_list_length(gIter), rsc->
id);
424 }
else if (is_nonempty_group(rsc)) {
428 pe_rsc_trace(rsc,
"Checking additional %d optional 'with group %s' "
429 "constraints using last member %s",
430 g_list_length(gIter), rsc->
id, last_rsc->
id);
435 "Checking additional %d optional 'with %s' constraints",
436 g_list_length(gIter), rsc->
id);
439 for (; gIter != NULL; gIter = gIter->next) {
444 other = constraint->
rsc_rh;
445 }
else if (!pcmk__colocation_has_influence(constraint, NULL)) {
448 other = constraint->
rsc_lh;
451 pe_rsc_trace(rsc,
"Optionally merging score of '%s' constraint (%s with %s)",
462 pe_rsc_info(rsc,
"%s: Rolling back optional scores from %s",
464 g_hash_table_destroy(work);
474 g_hash_table_iter_init(&iter, work);
475 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
483 g_hash_table_destroy(nodes);
513 pe_rsc_debug(rsc,
"Escalating allocation of %s to its parent: %s", rsc->
id,
523 pe_rsc_debug(rsc,
"Dependency loop detected involving %s", rsc->
id);
530 for (gIter = rsc->
rsc_cons; gIter != NULL; gIter = gIter->next) {
533 GHashTable *archive = NULL;
542 "%s: Allocating %s first (constraint=%s score=%d role=%s)",
543 rsc->
id, rsc_rh->id, constraint->
id,
545 rsc_rh->cmds->allocate(rsc_rh, NULL, data_set);
548 pe_rsc_info(rsc,
"%s: Rolling back scores from %s", rsc->
id, rsc_rh->id);
554 g_hash_table_destroy(archive);
560 for (gIter = rsc->
rsc_cons_lhs; gIter != NULL; gIter = gIter->next) {
563 if (!pcmk__colocation_has_influence(constraint, NULL)) {
566 pe_rsc_trace(rsc,
"Merging score of '%s' constraint (%s with %s)",
577 pe_rsc_trace(rsc,
"Making sure %s doesn't get allocated", rsc->
id);
584 crm_notice(
"Resource %s cannot be elevated from %s to %s: no-quorum-policy=freeze",
597 const char *reason = NULL;
601 assign_to = pe__current_node(rsc);
602 if (assign_to == NULL) {
611 pe_rsc_info(rsc,
"Unmanaged resource %s allocated to %s: %s", rsc->
id,
612 (assign_to? assign_to->
details->
uname :
"no node"), reason);
620 && native_choose_node(rsc, prefer, data_set)) {
626 pe_rsc_info(rsc,
"Resource %s cannot run anywhere", rsc->
id);
643 crm_trace(
"Setting Pacemaker Remote node %s to ONLINE",
653 crm_trace(
"Setting Pacemaker Remote node %s to SHUTDOWN (next role %s, %sallocated)",
666 gboolean dup = FALSE;
667 const char *
id = NULL;
668 const char *value = NULL;
669 xmlNode *operation = NULL;
670 guint interval2_ms = 0;
673 for (operation = pcmk__xe_first_child(rsc->
ops_xml); operation != NULL;
674 operation = pcmk__xe_next(operation)) {
676 if (pcmk__str_eq((
const char *)operation->name,
"op",
pcmk__str_none)) {
684 if (interval_ms != interval2_ms) {
693 "same name and interval combination more "
694 "than once per resource)",
ID(operation),
id);
704 op_cannot_recur(
const char *name)
714 const char *name = NULL;
715 const char *role = NULL;
716 const char *interval_spec = NULL;
717 const char *node_uname = node? node->
details->
uname :
"n/a";
719 guint interval_ms = 0;
721 gboolean is_optional = TRUE;
722 GList *possible_matches = NULL;
734 if (interval_ms == 0) {
739 if (is_op_dup(rsc, name, interval_ms)) {
740 crm_trace(
"Not creating duplicate recurring action %s for %dms %s",
741 ID(operation), interval_ms, name);
745 if (op_cannot_recur(name)) {
747 ID(operation), name);
753 crm_trace(
"Not creating recurring action %s for disabled resource %s",
754 ID(operation), rsc->
id);
759 pe_rsc_trace(rsc,
"Creating recurring action %s for %s in role %s on %s",
774 if (possible_matches == NULL) {
776 pe_rsc_trace(rsc,
"Marking %s mandatory: not active", key);
781 for (gIter = possible_matches; gIter != NULL; gIter = gIter->next) {
789 g_list_free(possible_matches);
795 const char *result =
"Ignoring";
798 char *after_key = NULL;
802 log_level = LOG_INFO;
803 result =
"Cancelling";
804 cancel_op =
pe_cancel_op(rsc, name, interval_ms, node, data_set);
830 do_crm_log(log_level,
"%s action %s (%s vs. %s)",
838 mon =
custom_action(rsc, key, name, node, is_optional, TRUE, data_set);
845 pe_rsc_debug(rsc,
"%s\t %s (cancelled : start un-runnable)",
846 node_uname, mon->
uuid);
851 pe_rsc_debug(rsc,
"%s\t %s (cancelled : no node available)",
852 node_uname, mon->
uuid);
857 pe_rsc_info(rsc,
" Start recurring %s (%us) for %s on %s",
858 mon->
task, interval_ms / 1000, rsc->
id, node_uname);
865 free(running_promoted);
870 NULL, strdup(key), mon,
874 NULL, strdup(key), mon,
895 xmlNode *operation = NULL;
897 for (operation = pcmk__xe_first_child(rsc->
ops_xml);
899 operation = pcmk__xe_next(operation)) {
901 if (pcmk__str_eq((
const char *)operation->name,
"op",
pcmk__str_none)) {
902 RecurringOp(rsc, start, node, operation, data_set);
913 const char *name = NULL;
914 const char *role = NULL;
915 const char *interval_spec = NULL;
916 const char *node_uname = node? node->
details->
uname :
"n/a";
918 guint interval_ms = 0;
919 GList *possible_matches = NULL;
930 if (interval_ms == 0) {
935 if (is_op_dup(rsc, name, interval_ms)) {
936 crm_trace(
"Not creating duplicate recurring action %s for %dms %s",
937 ID(operation), interval_ms, name);
941 if (op_cannot_recur(name)) {
943 ID(operation), name);
949 crm_trace(
"Not creating recurring action %s for disabled resource %s",
950 ID(operation), rsc->
id);
957 crm_notice(
"Ignoring %s (recurring monitors for Stopped role are "
958 "not supported for anonymous clones)",
964 "Creating recurring action %s for %s in role %s on nodes where it should not be running",
970 if (possible_matches) {
973 g_list_free(possible_matches);
975 cancel_op =
pe_cancel_op(rsc, name, interval_ms, node, data_set);
985 pe_rsc_info(rsc,
"Cancel action %s (%s vs. %s) on %s",
990 for (gIter = data_set->
nodes; gIter != NULL; gIter = gIter->next) {
992 const char *stop_node_uname = stop_node->
details->
uname;
993 gboolean is_optional = TRUE;
994 gboolean probe_is_optional = TRUE;
995 gboolean stop_is_optional = TRUE;
997 char *rc_inactive = NULL;
998 GList *probe_complete_ops = NULL;
999 GList *stop_ops = NULL;
1000 GList *local_gIter = NULL;
1002 if (node && pcmk__str_eq(stop_node_uname, node_uname,
pcmk__str_casei)) {
1006 pe_rsc_trace(rsc,
"Creating recurring action %s for %s on %s",
1007 ID(operation), rsc->
id,
crm_str(stop_node_uname));
1011 if (possible_matches == NULL) {
1012 pe_rsc_trace(rsc,
"Marking %s mandatory on %s: not active", key,
1014 is_optional = FALSE;
1016 pe_rsc_trace(rsc,
"Marking %s optional on %s: already active", key,
1019 g_list_free(possible_matches);
1022 stopped_mon =
custom_action(rsc, strdup(key), name, stop_node, is_optional, TRUE, data_set);
1031 GList *pIter = NULL;
1033 for (pIter = probes; pIter != NULL; pIter = pIter->next) {
1040 g_list_free(probes);
1043 if (probe_complete_ops) {
1044 g_list_free(probe_complete_ops);
1049 for (local_gIter = stop_ops; local_gIter != NULL; local_gIter = local_gIter->next) {
1053 stop_is_optional = FALSE;
1057 crm_debug(
"%s\t %s (cancelled : stop un-runnable)",
1058 crm_str(stop_node_uname), stopped_mon->uuid);
1060 __func__, __LINE__);
1065 NULL, strdup(key), stopped_mon,
1072 g_list_free(stop_ops);
1075 if (is_optional == FALSE && probe_is_optional && stop_is_optional
1077 pe_rsc_trace(rsc,
"Marking %s optional on %s due to unmanaged",
1078 key,
crm_str(stop_node_uname));
1088 pe_rsc_debug(rsc,
"%s\t %s (cancelled : no node available)",
1089 crm_str(stop_node_uname), stopped_mon->uuid);
1091 __func__, __LINE__);
1096 crm_notice(
" Start recurring %s (%us) for %s on %s", stopped_mon->task,
1097 interval_ms / 1000, rsc->
id,
crm_str(stop_node_uname));
1109 xmlNode *operation = NULL;
1111 for (operation = pcmk__xe_first_child(rsc->
ops_xml);
1113 operation = pcmk__xe_next(operation)) {
1115 if (pcmk__str_eq((
const char *)operation->name,
"op",
pcmk__str_none)) {
1116 RecurringOp_Stopped(rsc, start, node, operation, data_set);
1131 pe_rsc_trace(rsc,
"Processing migration actions %s moving from %s to %s . partial migration = %s",
1136 if (partial == FALSE) {
1144 if ((migrate_to && migrate_from) || (migrate_from && partial)) {
1217 gboolean need_stop = FALSE;
1218 bool need_promote = FALSE;
1219 gboolean is_moving = FALSE;
1222 GList *gIter = NULL;
1223 unsigned int num_all_active = 0;
1224 unsigned int num_clean_active = 0;
1225 bool multiply_active = FALSE;
1237 pe_rsc_trace(rsc,
"Creating all actions for %s transition from %s to %s (%s) on %s",
1240 ((chosen == NULL)?
"no node" : chosen->
details->
uname));
1249 pe_rsc_trace(rsc,
"Creating stop action %sfor %s on %s due to dangling migration",
1255 DeleteRsc(rsc, dangling_source, FALSE, data_set);
1259 if ((num_all_active == 2) && (num_clean_active == 2) && chosen
1268 pe_rsc_trace(rsc,
"Will attempt to continue with partial migration "
1269 "to target %s from %s",
1281 multiply_active = (num_clean_active > 1);
1283 multiply_active = (num_all_active > 1);
1286 if (multiply_active) {
1289 crm_notice(
"Resource %s can no longer migrate from %s to %s "
1290 "(will stop on both nodes)",
1298 pe_proc_err(
"%s resource %s is active on %u nodes (%s)",
1299 crm_str(
class), rsc->id, num_all_active,
1300 recovery2text(rsc->recovery_type));
1301 crm_notice(
"See https://wiki.clusterlabs.org/wiki/FAQ#Resource_is_Too_Active for more information");
1312 allow_migrate = FALSE;
1316 pe_rsc_trace(rsc,
"Creating start action for %s to represent already pending start",
1336 need_promote = TRUE;
1345 pe_rsc_trace(rsc,
"Creating start action for promoted resource %s",
1350 pe_rsc_trace(rsc,
"%s restart is required for recovery", rsc->
id);
1361 pe_rsc_trace(rsc,
"Creating %s action to take %s down from %s to %s",
1362 (need_stop?
"required" :
"optional"), rsc->
id,
1364 if (rsc_action_matrix[role][next_role] (rsc, current, !need_stop, data_set) == FALSE) {
1373 bool required = need_stop;
1375 next_role = rsc_state_matrix[role][rsc->
role];
1379 pe_rsc_trace(rsc,
"Creating %s action to take %s up from %s to %s",
1380 (required?
"required" :
"optional"), rsc->
id,
1382 if (rsc_action_matrix[role][next_role](rsc, chosen, !required,
1383 data_set) == FALSE) {
1392 next_role = rsc_state_matrix[role][rsc->
next_role];
1393 pe_rsc_trace(rsc,
"Creating action to take %s from %s to %s (ending at %s)",
1396 if (rsc_action_matrix[role][next_role] (rsc, chosen, FALSE, data_set) == FALSE) {
1403 pe_rsc_trace(rsc,
"Not creating recurring monitors for blocked resource %s",
1408 pe_rsc_trace(rsc,
"Creating recurring monitors for %s resource %s",
1412 Recurring(rsc, start, chosen, data_set);
1413 Recurring_Stopped(rsc, start, chosen, data_set);
1416 pe_rsc_trace(rsc,
"Creating recurring monitors for inactive resource %s",
1418 Recurring_Stopped(rsc, NULL, NULL, data_set);
1425 pe_rsc_trace(rsc,
"Not allowing partial migration of %s to continue",
1427 allow_migrate = FALSE;
1430 || pcmk_any_flags_set(rsc->
flags,
1435 allow_migrate = FALSE;
1438 if (allow_migrate) {
1439 handle_migration_actions(rsc, current, chosen, data_set);
1446 GHashTableIter iter;
1449 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
1473 GList *allowed_nodes = NULL;
1476 allowed_nodes = g_hash_table_get_values(rsc->
allowed_nodes);
1483 return allowed_nodes;
1492 GList *allowed_nodes = NULL;
1493 bool check_unfencing = FALSE;
1494 bool check_utilization = FALSE;
1498 "Skipping native constraints for unmanaged resource: %s",
1511 check_utilization = (g_hash_table_size(rsc->
utilization) > 0)
1541 if (check_unfencing || check_utilization || rsc->
container) {
1542 allowed_nodes = allowed_nodes_as_list(rsc, data_set);
1545 if (check_unfencing) {
1548 for (GList *item = allowed_nodes; item; item = item->next) {
1552 crm_debug(
"Ordering any stops of %s before %s, and any starts after",
1571 NULL, strdup(unfence->
uuid), unfence,
1581 if (check_utilization) {
1582 GList *gIter = NULL;
1584 pe_rsc_trace(rsc,
"Creating utilization constraints for %s - strategy: %s",
1587 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
1594 if (load_stopped->
node == NULL) {
1597 __func__, __LINE__);
1601 NULL, load_stopped_task, load_stopped,
pe_order_load, data_set);
1604 for (GList *item = allowed_nodes; item; item = item->next) {
1610 if (load_stopped->
node == NULL) {
1613 __func__, __LINE__);
1623 free(load_stopped_task);
1638 rsc_avoids_remote_nodes(rsc->
container);
1668 for (GList *item = allowed_nodes; item; item = item->next) {
1683 crm_trace(
"Order and colocate %s relative to its container %s",
1704 rsc->
container, NULL, NULL,
true, data_set);
1711 rsc_avoids_remote_nodes(rsc);
1713 g_list_free(allowed_nodes);
1721 if (rsc_lh == NULL) {
1722 pe_err(
"rsc_lh was NULL for %s", constraint->
id);
1725 }
else if (constraint->
rsc_rh == NULL) {
1726 pe_err(
"rsc_rh was NULL for %s", constraint->
id);
1730 pe_rsc_trace(rsc_lh,
"Processing colocation constraint between %s and %s", rsc_lh->
id,
1766 if ((rh_node == NULL)
1768 crm_err(
"%s must be colocated with %s but is not (%s vs. %s)",
1769 rsc_lh->
id, rsc_rh->
id,
1777 if ((rh_node != NULL)
1779 crm_err(
"%s and %s must be anti-colocated but are allocated "
1780 "to the same node (%s)",
1787 if (constraint->
score > 0
1789 crm_trace(
"LH: Skipping constraint: \"%s\" state filter nextrole is %s",
1794 if (constraint->
score > 0
1800 if (constraint->
score < 0
1802 crm_trace(
"LH: Skipping negative constraint: \"%s\" state filter",
1807 if (constraint->
score < 0
1809 crm_trace(
"RH: Skipping negative constraint: \"%s\" state filter",
1821 const char *rh_value = NULL;
1822 const char *lh_value = NULL;
1824 int score_multiplier = 1;
1850 score_multiplier = -1;
1862 const char *value = NULL;
1863 GHashTable *work = NULL;
1864 GHashTableIter iter;
1874 }
else if (constraint->
score < 0) {
1881 g_hash_table_iter_init(&iter, work);
1882 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
1886 constraint->
score, rsc_rh->
id);
1892 constraint->
id, rsc_lh->
id,
1900 constraint->
score, attribute);
1913 "%s: Rolling back scores from %s (no available nodes)",
1914 rsc_lh->
id, rsc_rh->
id);
1918 g_hash_table_destroy(work);
1932 pe_rsc_trace(rsc_lh,
"%s %s with %s (%s, score=%d, filter=%d)",
1933 ((constraint->
score > 0)?
"Colocating" :
"Anti-colocating"),
1934 rsc_lh->
id, rsc_rh->
id, constraint->
id, constraint->
score, filter_results);
1936 switch (filter_results) {
1938 influence_priority(rsc_lh, rsc_rh, constraint);
1941 colocation_match(rsc_lh, rsc_rh, constraint);
1953 pe_rsc_trace(rsc_lh,
"LH: Skipping constraint: \"%s\" state filter",
1964 if (rsc_ticket == NULL) {
1965 pe_err(
"rsc_ticket was NULL");
1969 if (rsc_lh == NULL) {
1970 pe_err(
"rsc_lh was NULL for %s", rsc_ticket->
id);
1981 pe_rsc_trace(rsc_lh,
"Processing ticket dependencies from %s", rsc_lh->
id);
1983 for (; gIter != NULL; gIter = gIter->next) {
1991 pe_rsc_trace(rsc_lh,
"%s: Processing ticket dependency on %s (%s, %s)",
1998 GList *gIter = NULL;
2013 if (filter_rsc_ticket(rsc_lh, rsc_ticket) == FALSE) {
2019 for (gIter = rsc_lh->
running_on; gIter != NULL; gIter = gIter->next) {
2022 pe_fence_node(data_set, node,
"deadman ticket was lost", FALSE);
2027 if (filter_rsc_ticket(rsc_lh, rsc_ticket) == FALSE) {
2056 return action->
flags;
2080 const char *reason = NULL;
2103 if (reason == NULL) {
2142 crm_trace(
"Testing %s on %s (0x%.6x) with %s 0x%.6x",
2190 pe_rsc_trace(first->
rsc,
"Unset migrate runnable on %s because of %s",
2198 ((then->
flags & pe_action_optional) == FALSE) &&
2218 pe_rsc_trace(then->
rsc,
"Unset runnable on %s because %s is neither runnable or migratable", first->
uuid, then->
uuid);
2261 handle_restart_ordering(first, then, filter);
2264 if (then_flags != then->
flags) {
2267 "Then: Flags for %s on %s are now 0x%.6x (was 0x%.6x) because of %s 0x%.6x",
2277 if (first_flags != first->
flags) {
2280 "First: Flags for %s on %s are now 0x%.6x (was 0x%.6x) because of %s 0x%.6x",
2291 GList *gIter = NULL;
2292 bool need_role =
false;
2294 CRM_CHECK((constraint != NULL) && (rsc != NULL),
return);
2300 "Not applying %s to %s because role will be %s not %s",
2307 pe_rsc_trace(rsc,
"Not applying %s to %s because no nodes match",
2308 constraint->
id, rsc->
id);
2313 (need_role?
" for role " :
""),
2316 for (gIter = constraint->
node_list_rh; gIter != NULL; gIter = gIter->next) {
2322 if (other_node != NULL) {
2332 g_hash_table_insert(rsc->
allowed_nodes, (gpointer) other_node->details->id, other_node);
2335 if (other_node->rsc_discover_mode < constraint->
discover_mode) {
2348 GList *gIter = NULL;
2353 for (gIter = rsc->
actions; gIter != NULL; gIter = gIter->next) {
2356 crm_trace(
"processing action %d for rsc=%s", action->
id, rsc->
id);
2360 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
2363 child_rsc->
cmds->
expand(child_rsc, data_set);
2367 #define STOP_SANITY_ASSERT(lineno) do { \
2368 if(current && current->details->unclean) { \
2370 } else if(stop == NULL) { \
2371 crm_err("%s:%d: No stop action exists for %s", \
2372 __func__, lineno, rsc->id); \
2373 CRM_ASSERT(stop != NULL); \
2374 } else if (pcmk_is_set(stop->flags, pe_action_optional)) { \
2375 crm_err("%s:%d: Action %s is still optional", \
2376 __func__, lineno, stop->uuid); \
2377 CRM_ASSERT(!pcmk_is_set(stop->flags, pe_action_optional)); \
2389 gboolean moving = FALSE;
2397 GList *gIter = NULL;
2399 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
2409 current = pe__current_node(rsc);
2424 out->
message(out,
"rsc-action", rsc, current, next, moving);
2430 GList *gIter = NULL;
2435 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
2459 __func__, __LINE__);
2463 DeleteRsc(rsc, current, optional, data_set);
2470 if (!node_has_been_unfenced(current)) {
2490 if (is_unfence_device(rsc, data_set)
2501 if (!node_has_been_unfenced(node)) {
2525 __func__, __LINE__);
2535 GList *gIter = NULL;
2536 gboolean runnable = TRUE;
2537 GList *action_list = NULL;
2545 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
2552 g_list_free(action_list);
2563 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
2567 __func__, __LINE__);
2570 g_list_free(action_list);
2577 GList *gIter = NULL;
2583 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
2616 }
else if (node == NULL) {
2617 pe_rsc_trace(rsc,
"Resource %s not deleted: NULL node", rsc->
id);
2621 pe_rsc_trace(rsc,
"Resource %s not deleted from %s: unrunnable", rsc->
id,
2650 static const char *rc_promoted = NULL;
2651 static const char *rc_inactive = NULL;
2653 if (rc_inactive == NULL) {
2660 pe_rsc_trace(rsc,
"Skipping active resource detection for %s", rsc->
id);
2669 "Skipping probe for %s on %s because Pacemaker Remote nodes cannot run stonith agents",
2675 "Skipping probe for %s on %s because guest nodes cannot run resources containing guest nodes",
2678 }
else if (rsc->is_remote_node) {
2680 "Skipping probe for %s on %s because Pacemaker Remote nodes cannot host remote connections",
2687 GList *gIter = NULL;
2688 gboolean any_created = FALSE;
2690 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
2693 any_created = child_rsc->
cmds->
create_probe(child_rsc, node, complete, force, data_set)
2718 if (allowed == NULL) {
2779 pe_rsc_trace(rsc,
"Skipping probe for %s on node %s, %s is stopped",
2800 pe_rsc_trace(rsc,
"Skipping probe for %s on node %s, %s is stopping, restarting or moving",
2821 if (running == NULL) {
2831 if (is_unfence_device(rsc, data_set) || !pe_rsc_is_clone(top)) {
2856 if (!is_unfence_device(rsc, data_set)) {
2885 && pe_rsc_is_anon_clone(rsc->
parent)
2908 GList *gIter = NULL;
2911 target = stonith_op->
node;
2913 for (gIter = rsc->
actions; gIter != NULL; gIter = gIter->next) {
2916 switch (action->
needs) {
2928 && !rsc_is_known_on(rsc, target)) {
2952 GList *gIter = NULL;
2953 GList *action_list = NULL;
2954 bool order_implicit =
false;
2961 target = stonith_op->
node;
2975 order_implicit =
true;
2978 if (action_list && order_implicit) {
2982 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
2987 __func__, __LINE__);
2989 if (order_implicit) {
2991 __func__, __LINE__);
3005 if (!pe_rsc_is_bundled(rsc)) {
3012 crm_notice(
"Stop of failed resource %s is implicit %s %s is fenced",
3013 rsc->
id, (order_implicit?
"after" :
"because"),
3016 crm_info(
"%s is implicit %s %s is fenced",
3017 action->
uuid, (order_implicit?
"after" :
"because"),
3077 g_list_free(action_list);
3082 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
3090 "Demote of failed resource %s is implicit after %s is fenced",
3093 pe_rsc_info(rsc,
"%s is implicit after %s is fenced",
3101 __func__, __LINE__);
3103 if (pe_rsc_is_bundled(rsc)) {
3106 }
else if (order_implicit) {
3112 g_list_free(action_list);
3119 GList *gIter = NULL;
3121 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
3128 pe_rsc_trace(rsc,
"Skipping fencing constraints for unmanaged resource: %s", rsc->
id);
3131 native_start_constraints(rsc, stonith_op, data_set);
3132 native_stop_constraints(rsc, stonith_op, data_set);
3139 GList *gIter = NULL;
3143 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
3162 pe_rsc_trace(rsc,
"%s: preventing agent reload because failed",
3170 pe_rsc_trace(rsc,
"%s: preventing agent reload because start pending",
3175 }
else if (node == NULL) {
3184 FALSE, TRUE, data_set);
3218 for (parent = rsc; parent != NULL; parent = parent->
parent) {
pe_action_t * pe_cancel_op(pe_resource_t *rsc, const char *name, guint interval_ms, pe_node_t *node, pe_working_set_t *data_set)
#define CRM_CHECK(expr, failure_action)
pe_node_t * pe_find_node(GList *node_list, const char *uname)
enum rsc_role_e role_filter
void pcmk__bundle_log_actions(pe_resource_t *rsc, pe_working_set_t *data_set)
enum rsc_start_requirement needs
enum pe_quorum_policy no_quorum_policy
#define crm_notice(fmt, args...)
bool pe__is_guest_or_remote_node(const pe_node_t *node)
gboolean(* create_probe)(pe_resource_t *, pe_node_t *, pe_action_t *, gboolean, pe_working_set_t *)
#define pe_rsc_debug(rsc, fmt, args...)
#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)
enum rsc_role_e(* state)(const pe_resource_t *, gboolean)
GList * sort_nodes_by_weight(GList *nodes, pe_node_t *active_node, pe_working_set_t *data_set)
#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
gboolean PromoteRsc(pe_resource_t *rsc, pe_node_t *next, gboolean optional, pe_working_set_t *data_set)
resource_alloc_functions_t * cmds
void pcmk__new_colocation(const char *id, const char *node_attr, int score, pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, const char *state_lh, const char *state_rh, bool influence, pe_working_set_t *data_set)
void native_rsc_colocation_lh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
#define pe_action_implies(action, reason, flag)
void rsc_ticket_constraint(pe_resource_t *lh_rsc, rsc_ticket_t *rsc_ticket, pe_working_set_t *data_set)
#define delete_action(rsc, node, optional)
#define pe_flag_remove_after_stop
enum pe_action_flags(* action_flags)(pe_action_t *, pe_node_t *)
#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
gboolean native_assign_node(pe_resource_t *rsc, pe_node_t *chosen, gboolean force)
char * score2char_stack(int score, char *buf, size_t len)
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_node_t * pe__copy_node(const pe_node_t *this_node)
void ReloadRsc(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set)
int(* message)(pcmk__output_t *out, const char *message_id,...)
GHashTable *(* merge_weights)(pe_resource_t *, const char *, GHashTable *, const char *, float, enum pe_weights)
void resource_location(pe_resource_t *rsc, pe_node_t *node, int score, const char *tag, pe_working_set_t *data_set)
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)
void native_expand(pe_resource_t *rsc, pe_working_set_t *data_set)
enum crm_ais_msg_types type
void native_rsc_location(pe_resource_t *rsc, pe__location_t *constraint)
pe_node_t * partial_migration_target
gboolean RoleError(pe_resource_t *rsc, pe_node_t *next, gboolean optional, pe_working_set_t *data_set)
GHashTable * pcmk__native_merge_weights(pe_resource_t *rsc, const char *rhs, GHashTable *nodes, const char *attr, float factor, uint32_t flags)
#define pe_rsc_allow_remote_remotes
gboolean can_run_resources(const pe_node_t *node)
#define pe_flag_have_quorum
#define CRM_SCORE_INFINITY
#define pe_proc_err(fmt...)
gboolean remote_requires_reset
char * crm_meta_name(const char *field)
#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 pe_flag_stop_everything
#define demote_action(rsc, node, optional)
#define pe_rsc_provisional
const char * role2text(enum rsc_role_e role)
void native_internal_constraints(pe_resource_t *rsc, pe_working_set_t *data_set)
#define CRM_ATTR_UNFENCED
GList * dangling_migrations
enum pe_discover_e discover_mode
#define CRMD_ACTION_RELOAD_AGENT
void native_create_actions(pe_resource_t *rsc, pe_working_set_t *data_set)
void pe_action_set_reason(pe_action_t *action, const char *reason, bool overwrite)
gboolean DemoteRsc(pe_resource_t *rsc, pe_node_t *next, gboolean optional, pe_working_set_t *data_set)
void native_rsc_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
#define pe_rsc_allow_migrate
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)
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
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
gboolean update_action(pe_action_t *action, pe_working_set_t *data_set)
#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...)
#define do_crm_log(level, fmt, args...)
Log a message.
void pe_fence_node(pe_working_set_t *data_set, pe_node_t *node, const char *reason, bool priority_delay)
Schedule a fence action for a node.
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
void process_utilization(pe_resource_t *rsc, pe_node_t **prefer, pe_working_set_t *data_set)
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
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
enum rsc_recovery_type recovery_type
enum loss_ticket_policy_e loss_policy
#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
xmlNode * find_rsc_op_entry(pe_resource_t *rsc, const char *key)
void(* expand)(pe_resource_t *, pe_working_set_t *)
void LogActions(pe_resource_t *rsc, pe_working_set_t *data_set)
#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)
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 XML_RSC_ATTR_TARGET_ROLE
#define XML_LRM_ATTR_MIGRATE_TARGET
#define XML_RSC_ATTR_REMOTE_NODE
gboolean update_action_flags(pe_action_t *action, enum pe_action_flags flags, const char *source, int line)
#define pe_rsc_allocating
enum rsc_role_e text2role(const char *role)
enum pe_obj_types variant
int new_rsc_order(pe_resource_t *lh_rsc, const char *lh_task, pe_resource_t *rh_rsc, const char *rh_task, enum pe_ordering type, pe_working_set_t *data_set)
const char * placement_strategy
gboolean can_run_any(GHashTable *nodes)
char * pcmk__op_key(const char *rsc_id, const char *op_type, guint interval_ms)
Generate an operation key (RESOURCE_ACTION_INTERVAL)
void(* rsc_colocation_rh)(pe_resource_t *, pe_resource_t *, pcmk__colocation_t *, pe_working_set_t *)
#define pe_rsc_fence_device
GHashTable * pcmk__copy_node_table(GHashTable *nodes)
pe_node_t * pe_find_node_id(GList *node_list, const char *id)
enum filter_colocation_res filter_colocation_constraint(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, pcmk__colocation_t *constraint, gboolean preview)
#define PCMK_RESOURCE_CLASS_STONITH
gboolean(* rsc_transition_fn)(pe_resource_t *rsc, pe_node_t *next, gboolean optional, pe_working_set_t *data_set)
void add_hash_param(GHashTable *hash, const char *name, const char *value)
#define start_action(rsc, node, optional)
int pe__add_scores(int score1, int score2)
#define crm_err(fmt, args...)
char guint crm_parse_interval_spec(const char *input)
Parse milliseconds from a Pacemaker interval specification.
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)
This structure contains everything that makes up a single output formatter.
#define pe_rsc_needs_unfencing
#define pe__clear_resource_flags(resource, flags_to_clear)
rsc_role_e
Possible roles that a resource can be in.
void native_append_meta(pe_resource_t *rsc, xmlNode *xml)
enum pe_action_flags flags
#define pe_rsc_maintenance
pe_working_set_t * cluster
const char * node_attribute
#define XML_OP_ATTR_PENDING
#define pe_flag_have_stonith_resource
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...)
#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.
#define XML_LRM_ATTR_MIGRATE_SOURCE
#define CRM_OP_LRM_DELETE
gint sort_node_uname(gconstpointer a, gconstpointer b)
#define pe_flag_show_scores
gboolean DeleteRsc(pe_resource_t *rsc, pe_node_t *node, gboolean optional, pe_working_set_t *data_set)
void graph_element_from_action(pe_action_t *action, pe_working_set_t *data_set)
#define crm_info(fmt, args...)
enum pe_action_flags native_action_flags(pe_action_t *action, pe_node_t *node)
pe_action_t * find_first_action(GList *input, const char *uuid, const char *task, pe_node_t *on_node)
void(* rsc_colocation_lh)(pe_resource_t *, pe_resource_t *, pcmk__colocation_t *, pe_working_set_t *)
#define XML_ATTR_TE_TARGET_RC
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)
#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)
void create_secondary_notification(pe_action_t *action, pe_resource_t *rsc, pe_action_t *stonith_op, pe_working_set_t *data_set)
pe_node_t * pcmk__native_allocate(pe_resource_t *rsc, pe_node_t *preferred, pe_working_set_t *data_set)
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)
GHashTable * allowed_nodes
#define pe_flag_startup_probes
pe_node_t *(* allocate)(pe_resource_t *, pe_node_t *, pe_working_set_t *)