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;
227 best_node = node->details->uname;
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)",
288 node->details->uname, node->weight, factor, score);
293 crm_trace(
"%s: Filtering %d + %f * %d (node was marked unusable)",
294 node->details->uname, node->weight, factor, score);
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)",
320 node->details->uname, node->weight, factor, score,
326 if (only_positive && (new_score < 0) && (node->weight == 0)) {
327 crm_trace(
"%s: Filtering %d + %f * %d = %d (negative disallowed)",
328 node->details->uname, node->weight, factor, score,
333 crm_trace(
"%s: %d + %f * %d = %d", node->details->uname,
334 node->weight, factor, score, new_score);
335 node->weight = 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)) {
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";
830 do_crm_log(log_level,
"%s action %s (%s vs. %s)",
845 pe_rsc_debug(rsc,
"%s\t %s (cancelled : start un-runnable)",
846 node_uname, mon->
uuid);
850 pe_rsc_debug(rsc,
"%s\t %s (cancelled : no node available)",
851 node_uname, mon->
uuid);
855 pe_rsc_info(rsc,
" Start recurring %s (%us) for %s on %s",
856 mon->
task, interval_ms / 1000, rsc->
id, node_uname);
863 free(running_promoted);
868 NULL, strdup(key), mon,
872 NULL, strdup(key), mon,
893 xmlNode *operation = NULL;
895 for (operation = pcmk__xe_first_child(rsc->
ops_xml);
897 operation = pcmk__xe_next(operation)) {
899 if (pcmk__str_eq((
const char *)operation->name,
"op",
pcmk__str_none)) {
900 RecurringOp(rsc, start, node, operation, data_set);
911 const char *
name = NULL;
912 const char *role = NULL;
913 const char *interval_spec = NULL;
914 const char *node_uname = node? node->
details->
uname :
"n/a";
916 guint interval_ms = 0;
917 GList *possible_matches = NULL;
928 if (interval_ms == 0) {
933 if (is_op_dup(rsc,
name, interval_ms)) {
934 crm_trace(
"Not creating duplicate recurring action %s for %dms %s",
935 ID(operation), interval_ms,
name);
939 if (op_cannot_recur(
name)) {
947 crm_trace(
"Not creating recurring action %s for disabled resource %s",
948 ID(operation), rsc->
id);
955 crm_notice(
"Ignoring %s (recurring monitors for Stopped role are " 956 "not supported for anonymous clones)",
962 "Creating recurring action %s for %s in role %s on nodes where it should not be running",
968 if (possible_matches) {
971 g_list_free(possible_matches);
983 pe_rsc_info(rsc,
"Cancel action %s (%s vs. %s) on %s",
988 for (gIter = data_set->
nodes; gIter != NULL; gIter = gIter->next) {
990 const char *stop_node_uname = stop_node->
details->
uname;
991 gboolean is_optional = TRUE;
992 gboolean probe_is_optional = TRUE;
993 gboolean stop_is_optional = TRUE;
995 char *rc_inactive = NULL;
996 GList *probe_complete_ops = NULL;
997 GList *stop_ops = NULL;
998 GList *local_gIter = NULL;
1000 if (node && pcmk__str_eq(stop_node_uname, node_uname,
pcmk__str_casei)) {
1004 pe_rsc_trace(rsc,
"Creating recurring action %s for %s on %s",
1005 ID(operation), rsc->
id,
crm_str(stop_node_uname));
1009 if (possible_matches == NULL) {
1010 pe_rsc_trace(rsc,
"Marking %s mandatory on %s: not active", key,
1012 is_optional = FALSE;
1014 pe_rsc_trace(rsc,
"Marking %s optional on %s: already active", key,
1017 g_list_free(possible_matches);
1020 stopped_mon =
custom_action(rsc, strdup(key),
name, stop_node, is_optional, TRUE, data_set);
1029 GList *pIter = NULL;
1031 for (pIter = probes; pIter != NULL; pIter = pIter->next) {
1038 g_list_free(probes);
1041 if (probe_complete_ops) {
1042 g_list_free(probe_complete_ops);
1047 for (local_gIter = stop_ops; local_gIter != NULL; local_gIter = local_gIter->next) {
1051 stop_is_optional = FALSE;
1055 crm_debug(
"%s\t %s (cancelled : stop un-runnable)",
1056 crm_str(stop_node_uname), stopped_mon->uuid);
1062 NULL, strdup(key), stopped_mon,
1069 g_list_free(stop_ops);
1072 if (is_optional == FALSE && probe_is_optional && stop_is_optional
1074 pe_rsc_trace(rsc,
"Marking %s optional on %s due to unmanaged",
1075 key,
crm_str(stop_node_uname));
1084 pe_rsc_debug(rsc,
"%s\t %s (cancelled : no node available)",
1085 crm_str(stop_node_uname), stopped_mon->uuid);
1091 crm_notice(
" Start recurring %s (%us) for %s on %s", stopped_mon->task,
1092 interval_ms / 1000, rsc->
id,
crm_str(stop_node_uname));
1104 xmlNode *operation = NULL;
1106 for (operation = pcmk__xe_first_child(rsc->
ops_xml);
1108 operation = pcmk__xe_next(operation)) {
1110 if (pcmk__str_eq((
const char *)operation->name,
"op",
pcmk__str_none)) {
1111 RecurringOp_Stopped(rsc, start, node, operation, data_set);
1126 pe_rsc_trace(rsc,
"Processing migration actions %s moving from %s to %s . partial migration = %s",
1131 if (partial == FALSE) {
1139 if ((migrate_to && migrate_from) || (migrate_from && partial)) {
1212 gboolean need_stop = FALSE;
1213 bool need_promote = FALSE;
1214 gboolean is_moving = FALSE;
1217 GList *gIter = NULL;
1218 unsigned int num_all_active = 0;
1219 unsigned int num_clean_active = 0;
1220 bool multiply_active = FALSE;
1232 pe_rsc_trace(rsc,
"Creating all actions for %s transition from %s to %s (%s) on %s",
1235 ((chosen == NULL)?
"no node" : chosen->
details->
uname));
1244 pe_rsc_trace(rsc,
"Creating stop action %sfor %s on %s due to dangling migration",
1250 DeleteRsc(rsc, dangling_source, FALSE, data_set);
1254 if ((num_all_active == 2) && (num_clean_active == 2) && chosen
1263 pe_rsc_trace(rsc,
"Will attempt to continue with partial migration " 1264 "to target %s from %s",
1276 multiply_active = (num_clean_active > 1);
1278 multiply_active = (num_all_active > 1);
1281 if (multiply_active) {
1284 crm_notice(
"Resource %s can no longer migrate from %s to %s " 1285 "(will stop on both nodes)",
1293 pe_proc_err(
"%s resource %s is active on %u nodes (%s)",
1294 crm_str(
class), rsc->id, num_all_active,
1295 recovery2text(rsc->recovery_type));
1296 crm_notice(
"See https://wiki.clusterlabs.org/wiki/FAQ#Resource_is_Too_Active for more information");
1307 allow_migrate = FALSE;
1311 pe_rsc_trace(rsc,
"Creating start action for %s to represent already pending start",
1331 need_promote = TRUE;
1340 pe_rsc_trace(rsc,
"Creating start action for promoted resource %s",
1345 pe_rsc_trace(rsc,
"%s restart is required for recovery", rsc->
id);
1356 pe_rsc_trace(rsc,
"Creating %s action to take %s down from %s to %s",
1357 (need_stop?
"required" :
"optional"), rsc->
id,
1359 if (rsc_action_matrix[role][next_role] (rsc, current, !need_stop, data_set) == FALSE) {
1368 bool required = need_stop;
1370 next_role = rsc_state_matrix[role][rsc->
role];
1374 pe_rsc_trace(rsc,
"Creating %s action to take %s up from %s to %s",
1375 (required?
"required" :
"optional"), rsc->
id,
1377 if (rsc_action_matrix[role][next_role](rsc, chosen, !required,
1378 data_set) == FALSE) {
1387 next_role = rsc_state_matrix[role][rsc->
next_role];
1388 pe_rsc_trace(rsc,
"Creating action to take %s from %s to %s (ending at %s)",
1391 if (rsc_action_matrix[role][next_role] (rsc, chosen, FALSE, data_set) == FALSE) {
1398 pe_rsc_trace(rsc,
"Not creating recurring monitors for blocked resource %s",
1403 pe_rsc_trace(rsc,
"Creating recurring monitors for %s resource %s",
1407 Recurring(rsc, start, chosen, data_set);
1408 Recurring_Stopped(rsc, start, chosen, data_set);
1411 pe_rsc_trace(rsc,
"Creating recurring monitors for inactive resource %s",
1413 Recurring_Stopped(rsc, NULL, NULL, data_set);
1420 pe_rsc_trace(rsc,
"Not allowing partial migration of %s to continue",
1422 allow_migrate = FALSE;
1425 || pcmk_any_flags_set(rsc->
flags,
1430 allow_migrate = FALSE;
1433 if (allow_migrate) {
1434 handle_migration_actions(rsc, current, chosen, data_set);
1441 GHashTableIter iter;
1444 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
1445 if (node->details->remote_rsc) {
1468 GList *allowed_nodes = NULL;
1471 allowed_nodes = g_hash_table_get_values(rsc->
allowed_nodes);
1478 return allowed_nodes;
1487 GList *allowed_nodes = NULL;
1488 bool check_unfencing = FALSE;
1489 bool check_utilization = FALSE;
1493 "Skipping native constraints for unmanaged resource: %s",
1506 check_utilization = (g_hash_table_size(rsc->
utilization) > 0)
1536 if (check_unfencing || check_utilization || rsc->
container) {
1537 allowed_nodes = allowed_nodes_as_list(rsc, data_set);
1540 if (check_unfencing) {
1543 for (GList *item = allowed_nodes; item; item = item->next) {
1547 crm_debug(
"Ordering any stops of %s before %s, and any starts after",
1566 NULL, strdup(unfence->
uuid), unfence,
1576 if (check_utilization) {
1577 GList *gIter = NULL;
1579 pe_rsc_trace(rsc,
"Creating utilization constraints for %s - strategy: %s",
1582 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
1589 if (load_stopped->
node == NULL) {
1595 NULL, load_stopped_task, load_stopped,
pe_order_load, data_set);
1598 for (GList *item = allowed_nodes; item; item = item->next) {
1604 if (load_stopped->
node == NULL) {
1616 free(load_stopped_task);
1631 rsc_avoids_remote_nodes(rsc->
container);
1661 for (GList *item = allowed_nodes; item; item = item->next) {
1676 crm_trace(
"Order and colocate %s relative to its container %s",
1697 rsc->
container, NULL, NULL,
true, data_set);
1704 rsc_avoids_remote_nodes(rsc);
1706 g_list_free(allowed_nodes);
1714 if (rsc_lh == NULL) {
1715 pe_err(
"rsc_lh was NULL for %s", constraint->
id);
1718 }
else if (constraint->
rsc_rh == NULL) {
1719 pe_err(
"rsc_rh was NULL for %s", constraint->
id);
1723 pe_rsc_trace(rsc_lh,
"Processing colocation constraint between %s and %s", rsc_lh->
id,
1759 if ((rh_node == NULL)
1761 crm_err(
"%s must be colocated with %s but is not (%s vs. %s)",
1762 rsc_lh->
id, rsc_rh->
id,
1770 if ((rh_node != NULL)
1772 crm_err(
"%s and %s must be anti-colocated but are allocated " 1773 "to the same node (%s)",
1780 if (constraint->
score > 0
1782 crm_trace(
"LH: Skipping constraint: \"%s\" state filter nextrole is %s",
1787 if (constraint->
score > 0
1793 if (constraint->
score < 0
1795 crm_trace(
"LH: Skipping negative constraint: \"%s\" state filter",
1800 if (constraint->
score < 0
1802 crm_trace(
"RH: Skipping negative constraint: \"%s\" state filter",
1814 const char *rh_value = NULL;
1815 const char *lh_value = NULL;
1817 int score_multiplier = 1;
1843 score_multiplier = -1;
1855 const char *value = NULL;
1856 GHashTable *work = NULL;
1857 GHashTableIter iter;
1867 }
else if (constraint->
score < 0) {
1874 g_hash_table_iter_init(&iter, work);
1875 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
1878 constraint->
id, rsc_lh->
id, node->details->uname,
1879 constraint->
score, rsc_rh->
id);
1885 constraint->
id, rsc_lh->
id,
1886 node->details->uname, constraint->
score);
1892 constraint->
id, rsc_lh->
id, node->details->uname,
1893 constraint->
score, attribute);
1906 "%s: Rolling back scores from %s (no available nodes)",
1907 rsc_lh->
id, rsc_rh->
id);
1911 g_hash_table_destroy(work);
1925 pe_rsc_trace(rsc_lh,
"%s %s with %s (%s, score=%d, filter=%d)",
1926 ((constraint->
score > 0)?
"Colocating" :
"Anti-colocating"),
1927 rsc_lh->
id, rsc_rh->
id, constraint->
id, constraint->
score, filter_results);
1929 switch (filter_results) {
1931 influence_priority(rsc_lh, rsc_rh, constraint);
1934 colocation_match(rsc_lh, rsc_rh, constraint);
1946 pe_rsc_trace(rsc_lh,
"LH: Skipping constraint: \"%s\" state filter",
1957 if (rsc_ticket == NULL) {
1958 pe_err(
"rsc_ticket was NULL");
1962 if (rsc_lh == NULL) {
1963 pe_err(
"rsc_lh was NULL for %s", rsc_ticket->
id);
1974 pe_rsc_trace(rsc_lh,
"Processing ticket dependencies from %s", rsc_lh->
id);
1976 for (; gIter != NULL; gIter = gIter->next) {
1984 pe_rsc_trace(rsc_lh,
"%s: Processing ticket dependency on %s (%s, %s)",
1991 GList *gIter = NULL;
2006 if (filter_rsc_ticket(rsc_lh, rsc_ticket) == FALSE) {
2012 for (gIter = rsc_lh->
running_on; gIter != NULL; gIter = gIter->next) {
2015 pe_fence_node(data_set, node,
"deadman ticket was lost", FALSE);
2020 if (filter_rsc_ticket(rsc_lh, rsc_ticket) == FALSE) {
2073 const char *reason = NULL;
2096 if (reason == NULL) {
2135 crm_trace(
"Testing %s on %s (0x%.6x) with %s 0x%.6x",
2179 "Unset optional on %s because %s implies first",
2187 pe_rsc_trace(first->
rsc,
"Unset migrate runnable on %s because of %s",
2206 "Unset optional on %s because %s (promoted) implies first",
2217 pe_rsc_trace(then->
rsc,
"Unset runnable on %s because %s is neither runnable or migratable", first->
uuid, then->
uuid);
2254 "Unset optional on %s because %s implies 'then'",
2260 handle_restart_ordering(first, then, filter);
2263 if (then_flags != then->
flags) {
2266 "Then: Flags for %s on %s are now 0x%.6x (was 0x%.6x) because of %s 0x%.6x",
2276 if (first_flags != first->
flags) {
2279 "First: Flags for %s on %s are now 0x%.6x (was 0x%.6x) because of %s 0x%.6x",
2290 GList *gIter = NULL;
2291 bool need_role =
false;
2293 CRM_CHECK((constraint != NULL) && (rsc != NULL),
return);
2299 "Not applying %s to %s because role will be %s not %s",
2306 pe_rsc_trace(rsc,
"Not applying %s to %s because no nodes match",
2307 constraint->
id, rsc->
id);
2312 (need_role?
" for role " :
""),
2315 for (gIter = constraint->
node_list_rh; gIter != NULL; gIter = gIter->next) {
2321 if (other_node != NULL) {
2331 g_hash_table_insert(rsc->
allowed_nodes, (gpointer) other_node->details->id, other_node);
2334 if (other_node->rsc_discover_mode < constraint->
discover_mode) {
2347 GList *gIter = NULL;
2352 for (gIter = rsc->
actions; gIter != NULL; gIter = gIter->next) {
2359 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
2362 child_rsc->
cmds->
expand(child_rsc, data_set);
2366 #define STOP_SANITY_ASSERT(lineno) do { \ 2367 if(current && current->details->unclean) { \ 2369 } else if(stop == NULL) { \ 2370 crm_err("%s:%d: No stop action exists for %s", \ 2371 __func__, lineno, rsc->id); \ 2372 CRM_ASSERT(stop != NULL); \ 2373 } else if (pcmk_is_set(stop->flags, pe_action_optional)) { \ 2374 crm_err("%s:%d: Action %s is still optional", \ 2375 __func__, lineno, stop->uuid); \ 2376 CRM_ASSERT(!pcmk_is_set(stop->flags, pe_action_optional)); \ 2388 gboolean moving = FALSE;
2396 GList *gIter = NULL;
2398 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
2408 current = pe__current_node(rsc);
2423 out->
message(out,
"rsc-action", rsc, current, next, moving);
2429 GList *gIter = NULL;
2434 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
2461 DeleteRsc(rsc, current, optional, data_set);
2468 if (!node_has_been_unfenced(current)) {
2488 if (is_unfence_device(rsc, data_set)
2499 if (!node_has_been_unfenced(node)) {
2532 GList *gIter = NULL;
2533 gboolean runnable = TRUE;
2534 GList *action_list = NULL;
2542 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
2549 g_list_free(action_list);
2560 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
2566 g_list_free(action_list);
2573 GList *gIter = NULL;
2579 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
2612 }
else if (node == NULL) {
2613 pe_rsc_trace(rsc,
"Resource %s not deleted: NULL node", rsc->
id);
2617 pe_rsc_trace(rsc,
"Resource %s not deleted from %s: unrunnable", rsc->
id,
2646 static const char *rc_promoted = NULL;
2647 static const char *rc_inactive = NULL;
2649 if (rc_inactive == NULL) {
2656 pe_rsc_trace(rsc,
"Skipping active resource detection for %s", rsc->
id);
2665 "Skipping probe for %s on %s because Pacemaker Remote nodes cannot run stonith agents",
2671 "Skipping probe for %s on %s because guest nodes cannot run resources containing guest nodes",
2674 }
else if (rsc->is_remote_node) {
2676 "Skipping probe for %s on %s because Pacemaker Remote nodes cannot host remote connections",
2683 GList *gIter = NULL;
2684 gboolean any_created = FALSE;
2686 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
2689 any_created = child_rsc->
cmds->
create_probe(child_rsc, node, complete, force, data_set)
2714 if (allowed == NULL) {
2775 pe_rsc_trace(rsc,
"Skipping probe for %s on node %s, %s is stopped",
2796 pe_rsc_trace(rsc,
"Skipping probe for %s on node %s, %s is stopping, restarting or moving",
2816 if (running == NULL) {
2826 if (is_unfence_device(rsc, data_set) || !pe_rsc_is_clone(top)) {
2851 if (!is_unfence_device(rsc, data_set)) {
2880 && pe_rsc_is_anon_clone(rsc->
parent)
2903 GList *gIter = NULL;
2908 for (gIter = rsc->
actions; gIter != NULL; gIter = gIter->next) {
2923 && !rsc_is_known_on(rsc,
target)) {
2947 GList *gIter = NULL;
2948 GList *action_list = NULL;
2949 bool order_implicit =
false;
2970 order_implicit =
true;
2973 if (action_list && order_implicit) {
2977 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
2983 if (order_implicit) {
2998 if (!pe_rsc_is_bundled(rsc)) {
3005 crm_notice(
"Stop of failed resource %s is implicit %s %s is fenced",
3006 rsc->
id, (order_implicit?
"after" :
"because"),
3009 crm_info(
"%s is implicit %s %s is fenced",
3010 action->uuid, (order_implicit?
"after" :
"because"),
3070 g_list_free(action_list);
3075 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
3078 if (
action->node->details->online == FALSE ||
action->node->details->unclean == TRUE
3083 "Demote of failed resource %s is implicit after %s is fenced",
3086 pe_rsc_info(rsc,
"%s is implicit after %s is fenced",
3095 if (pe_rsc_is_bundled(rsc)) {
3098 }
else if (order_implicit) {
3104 g_list_free(action_list);
3111 GList *gIter = NULL;
3113 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
3120 pe_rsc_trace(rsc,
"Skipping fencing constraints for unmanaged resource: %s", rsc->
id);
3123 native_start_constraints(rsc, stonith_op, data_set);
3124 native_stop_constraints(rsc, stonith_op, data_set);
3131 GList *gIter = NULL;
3135 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
3154 pe_rsc_trace(rsc,
"%s: preventing agent reload because failed",
3162 pe_rsc_trace(rsc,
"%s: preventing agent reload because start pending",
3167 }
else if (node == NULL) {
3176 FALSE, TRUE, data_set);
3210 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)
#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)
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
int(* message)(pcmk__output_t *out, const char *message_id,...)
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)
#define pe_action_implies(action, reason, flag)
#define delete_action(rsc, node, optional)
#define pe_flag_remove_after_stop
#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)
void LogActions(pe_resource_t *rsc, pe_working_set_t *data_set)
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)
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 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 *)
gboolean RoleError(pe_resource_t *rsc, pe_node_t *next, gboolean optional, pe_working_set_t *data_set)
#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)
#define CRM_ATTR_UNFENCED
GList * dangling_migrations
enum pe_discover_e discover_mode
#define CRMD_ACTION_RELOAD_AGENT
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
pe_action_t * get_pseudo_op(const char *name, pe_working_set_t *data_set)
#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)
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
void native_internal_constraints(pe_resource_t *rsc, pe_working_set_t *data_set)
void native_rsc_colocation_lh(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, pcmk__colocation_t *constraint, 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
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.
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
void(* expand)(pe_resource_t *, pe_working_set_t *)
xmlNode * find_rsc_op_entry(pe_resource_t *rsc, const char *key)
#define pe_flag_stonith_enabled
void native_rsc_colocation_rh(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
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
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)
void native_rsc_location(pe_resource_t *rsc, pe__location_t *constraint)
const char * placement_strategy
enum filter_colocation_res filter_colocation_constraint(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, pcmk__colocation_t *constraint, gboolean preview)
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)
#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)
#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)
void ReloadRsc(pe_resource_t *rsc, pe_node_t *node, 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.
pe_node_t * pcmk__native_allocate(pe_resource_t *rsc, pe_node_t *prefer, pe_working_set_t *data_set)
void rsc_stonith_ordering(pe_resource_t *rsc, pe_action_t *stonith_op, 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)
GHashTable * pcmk__native_merge_weights(pe_resource_t *rsc, const char *rhs, GHashTable *nodes, const char *attr, float factor, uint32_t flags)
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
#define XML_OP_ATTR_PENDING
gboolean DeleteRsc(pe_resource_t *rsc, pe_node_t *node, gboolean optional, pe_working_set_t *data_set)
#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)
void rsc_ticket_constraint(pe_resource_t *rsc_lh, rsc_ticket_t *rsc_ticket, pe_working_set_t *data_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
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
void graph_element_from_action(pe_action_t *action, pe_working_set_t *data_set)
#define crm_info(fmt, args...)
pe_action_t * find_first_action(GList *input, const char *uuid, const char *task, pe_node_t *on_node)
#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)
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)
void create_secondary_notification(pe_action_t *action, pe_resource_t *rsc, pe_action_t *stonith_op, 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)
GHashTable * allowed_nodes
#define pe_flag_startup_probes