20 #define INFINITY_HACK (INFINITY * -100)
22 #define VARIANT_NATIVE 1
83 gboolean result = FALSE;
100 best = g_list_nth_data(nodes, 0);
103 if (prefer && nodes) {
106 if (chosen == NULL) {
107 pe_rsc_trace(rsc,
"Preferred node %s for %s was unknown",
117 pe_rsc_trace(rsc,
"Preferred node %s for %s was unsuitable",
122 pe_rsc_trace(rsc,
"Preferred node %s for %s was unavailable",
128 "Chose preferred node %s for %s (ignoring %d candidates)",
133 if ((chosen == NULL) && nodes) {
139 pe_rsc_trace(rsc,
"Chose node %s for %s from %d candidates",
142 if (!pe_rsc_is_unique_clone(rsc->
parent)
153 pe_node_t *running = pe__current_node(rsc);
156 pe_rsc_trace(rsc,
"Current node for %s (%s) can't run resources",
158 }
else if (running) {
159 for (GList *iter = nodes->next; iter; iter = iter->next) {
177 static char score[33];
178 int log_level = (chosen->
weight >=
INFINITY)? LOG_WARNING : LOG_INFO;
182 "Chose node %s for %s from %d nodes with score %s",
200 best_node_score_matching_attr(
const pe_resource_t *rsc,
const char *attr,
206 const char *best_node = NULL;
210 while (g_hash_table_iter_next(&iter, NULL, (
void **) &node)) {
215 best_score = node->weight;
216 best_node = node->details->uname;
221 if (best_node == NULL) {
222 crm_info(
"No allowed node for %s matches node attribute %s=%s",
223 rsc->
id, attr, value);
225 crm_info(
"Allowed node %s for %s had best score (%d) "
226 "of those matching node attribute %s=%s",
227 best_node, rsc->
id, best_score, attr, value);
248 add_node_scores_matching_attr(GHashTable *nodes,
const pe_resource_t *rsc,
249 const char *attr,
float factor,
260 g_hash_table_iter_init(&iter, nodes);
261 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
267 score = best_node_score_matching_attr(rsc, attr,
270 if ((factor < 0) && (score < 0)) {
276 crm_trace(
"%s: Filtering %d + %f * %d (double negative disallowed)",
277 node->details->uname, node->weight, factor, score);
282 crm_trace(
"%s: Filtering %d + %f * %d (node was marked unusable)",
283 node->details->uname, node->weight, factor, score);
287 weight_f = factor * score;
290 weight = (int) ((weight_f < 0)? (weight_f - 0.5) : (weight_f + 0.5));
296 if ((weight == 0) && (score != 0)) {
299 }
else if (factor < 0.0) {
306 if (only_positive && (new_score < 0) && (node->weight > 0)) {
307 crm_trace(
"%s: Filtering %d + %f * %d = %d "
308 "(negative disallowed, marking node unusable)",
309 node->details->uname, node->weight, factor, score,
315 if (only_positive && (new_score < 0) && (node->weight == 0)) {
316 crm_trace(
"%s: Filtering %d + %f * %d = %d (negative disallowed)",
317 node->details->uname, node->weight, factor, score,
322 crm_trace(
"%s: %d + %f * %d = %d", node->details->uname,
323 node->weight, factor, score, new_score);
324 node->weight = new_score;
351 GHashTable *nodes,
const char *attr,
float factor,
354 GHashTable *work = NULL;
358 pe_rsc_info(rsc,
"%s: Breaking dependency loop at %s", rhs, rsc->
id);
364 if (is_nonempty_group(rsc)) {
365 GList *last = g_list_last(rsc->
children);
369 "using last member %s (at %.6f)",
370 rhs, rsc->
id, last_rsc->
id, factor);
378 }
else if (is_nonempty_group(rsc)) {
389 pe_rsc_trace(rsc,
"%s: Merging scores from first member of group %s "
390 "(at %.6f)", rhs, rsc->
id, factor);
396 pe_rsc_trace(rsc,
"%s: Merging scores from %s (at %.6f)",
397 rhs, rsc->
id, factor);
399 add_node_scores_matching_attr(work, rsc, attr, factor,
405 int multiplier = (factor < 0)? -1 : 1;
410 "Checking additional %d optional '%s with' constraints",
411 g_list_length(gIter), rsc->
id);
413 }
else if (is_nonempty_group(rsc)) {
417 pe_rsc_trace(rsc,
"Checking additional %d optional 'with group %s' "
418 "constraints using last member %s",
419 g_list_length(gIter), rsc->
id, last_rsc->
id);
424 "Checking additional %d optional 'with %s' constraints",
425 g_list_length(gIter), rsc->
id);
428 for (; gIter != NULL; gIter = gIter->next) {
432 if (constraint->
score == 0) {
437 other = constraint->
rsc_rh;
439 other = constraint->
rsc_lh;
442 pe_rsc_trace(rsc,
"Optionally merging score of '%s' constraint (%s with %s)",
453 pe_rsc_info(rsc,
"%s: Rolling back optional scores from %s",
455 g_hash_table_destroy(work);
465 g_hash_table_iter_init(&iter, work);
466 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
474 g_hash_table_destroy(nodes);
486 return unfenced && strcmp(
"0", unfenced);
504 pe_rsc_debug(rsc,
"Escalating allocation of %s to its parent: %s", rsc->
id,
514 pe_rsc_debug(rsc,
"Dependency loop detected involving %s", rsc->
id);
521 for (gIter = rsc->
rsc_cons; gIter != NULL; gIter = gIter->next) {
524 GHashTable *archive = NULL;
527 if (constraint->
score == 0) {
537 "%s: Allocating %s first (constraint=%s score=%d role=%s)",
538 rsc->
id, rsc_rh->id, constraint->
id,
540 rsc_rh->cmds->allocate(rsc_rh, NULL, data_set);
543 pe_rsc_info(rsc,
"%s: Rolling back scores from %s", rsc->
id, rsc_rh->id);
549 g_hash_table_destroy(archive);
555 for (gIter = rsc->
rsc_cons_lhs; gIter != NULL; gIter = gIter->next) {
558 if (constraint->
score == 0) {
561 pe_rsc_trace(rsc,
"Merging score of '%s' constraint (%s with %s)",
572 pe_rsc_trace(rsc,
"Making sure %s doesn't get allocated", rsc->
id);
579 crm_notice(
"Resource %s cannot be elevated from %s to %s: no-quorum-policy=freeze",
591 const char *reason = NULL;
595 assign_to = pe__current_node(rsc);
596 if (assign_to == NULL) {
605 pe_rsc_info(rsc,
"Unmanaged resource %s allocated to %s: %s", rsc->
id,
606 (assign_to? assign_to->
details->
uname :
"no node"), reason);
614 && native_choose_node(rsc, prefer, data_set)) {
620 pe_rsc_info(rsc,
"Resource %s cannot run anywhere", rsc->
id);
637 crm_trace(
"Setting Pacemaker Remote node %s to ONLINE",
647 crm_trace(
"Setting Pacemaker Remote node %s to SHUTDOWN (next role %s, %sallocated)",
660 gboolean dup = FALSE;
661 const char *
id = NULL;
662 const char *value = NULL;
663 xmlNode *operation = NULL;
664 guint interval2_ms = 0;
667 for (operation = __xml_first_child_element(rsc->
ops_xml); operation != NULL;
668 operation = __xml_next_element(operation)) {
670 if (
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
678 if (interval_ms != interval2_ms) {
687 "same name and interval combination more "
688 "than once per resource)",
ID(operation),
id);
698 op_cannot_recur(
const char *
name)
711 const char *
name = NULL;
712 const char *role = NULL;
713 const char *interval_spec = NULL;
714 const char *node_uname = node? node->
details->
uname :
"n/a";
716 guint interval_ms = 0;
718 gboolean is_optional = TRUE;
731 if (interval_ms == 0) {
736 if (is_op_dup(rsc,
name, interval_ms)) {
737 crm_trace(
"Not creating duplicate recurring action %s for %dms %s",
738 ID(operation), interval_ms,
name);
742 if (op_cannot_recur(
name)) {
750 crm_trace(
"Not creating recurring action %s for disabled resource %s",
751 ID(operation), rsc->
id);
756 pe_rsc_trace(rsc,
"Creating recurring action %s for %s in role %s on %s",
771 if (possible_matches == NULL) {
773 pe_rsc_trace(rsc,
"Marking %s mandatory: not active", key);
778 for (gIter = possible_matches; gIter != NULL; gIter = gIter->next) {
786 g_list_free(possible_matches);
792 const char *result =
"Ignoring";
795 char *after_key = NULL;
799 log_level = LOG_INFO;
800 result =
"Cancelling";
827 do_crm_log(log_level,
"%s action %s (%s vs. %s)",
842 pe_rsc_debug(rsc,
"%s\t %s (cancelled : start un-runnable)",
843 node_uname, mon->
uuid);
847 pe_rsc_debug(rsc,
"%s\t %s (cancelled : no node available)",
848 node_uname, mon->
uuid);
852 pe_rsc_info(rsc,
" Start recurring %s (%us) for %s on %s",
853 mon->
task, interval_ms / 1000, rsc->
id, node_uname);
860 free(running_master);
865 NULL, strdup(key), mon,
869 NULL, strdup(key), mon,
890 xmlNode *operation = NULL;
892 for (operation = __xml_first_child_element(rsc->
ops_xml);
894 operation = __xml_next_element(operation)) {
896 if (
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
897 RecurringOp(rsc, start, node, operation, data_set);
908 const char *
name = NULL;
909 const char *role = NULL;
910 const char *interval_spec = NULL;
911 const char *node_uname = node? node->
details->
uname :
"n/a";
913 guint interval_ms = 0;
925 if (interval_ms == 0) {
930 if (is_op_dup(rsc,
name, interval_ms)) {
931 crm_trace(
"Not creating duplicate recurring action %s for %dms %s",
932 ID(operation), interval_ms,
name);
936 if (op_cannot_recur(
name)) {
944 crm_trace(
"Not creating recurring action %s for disabled resource %s",
945 ID(operation), rsc->
id);
952 crm_notice(
"Ignoring %s (recurring monitors for Stopped role are "
953 "not supported for anonymous clones)",
959 "Creating recurring action %s for %s in role %s on nodes where it should not be running",
965 if (possible_matches) {
968 g_list_free(possible_matches);
979 pe_rsc_info(rsc,
"Cancel action %s (%s vs. %s) on %s",
984 for (gIter = data_set->
nodes; gIter != NULL; gIter = gIter->next) {
986 const char *stop_node_uname = stop_node->
details->
uname;
987 gboolean is_optional = TRUE;
988 gboolean probe_is_optional = TRUE;
989 gboolean stop_is_optional = TRUE;
991 char *rc_inactive = NULL;
996 if (node &&
safe_str_eq(stop_node_uname, node_uname)) {
1000 pe_rsc_trace(rsc,
"Creating recurring action %s for %s on %s",
1001 ID(operation), rsc->
id,
crm_str(stop_node_uname));
1005 if (possible_matches == NULL) {
1006 pe_rsc_trace(rsc,
"Marking %s mandatory on %s: not active", key,
1008 is_optional = FALSE;
1010 pe_rsc_trace(rsc,
"Marking %s optional on %s: already active", key,
1013 g_list_free(possible_matches);
1016 stopped_mon =
custom_action(rsc, strdup(key),
name, stop_node, is_optional, TRUE, data_set);
1027 for (pIter = probes; pIter != NULL; pIter = pIter->next) {
1034 g_list_free(probes);
1037 if (probe_complete_ops) {
1038 g_list_free(probe_complete_ops);
1043 for (local_gIter = stop_ops; local_gIter != NULL; local_gIter = local_gIter->next) {
1047 stop_is_optional = FALSE;
1051 crm_debug(
"%s\t %s (cancelled : stop un-runnable)",
1052 crm_str(stop_node_uname), stopped_mon->uuid);
1058 NULL, strdup(key), stopped_mon,
1065 g_list_free(stop_ops);
1068 if (is_optional == FALSE && probe_is_optional && stop_is_optional
1070 pe_rsc_trace(rsc,
"Marking %s optional on %s due to unmanaged",
1071 key,
crm_str(stop_node_uname));
1080 pe_rsc_debug(rsc,
"%s\t %s (cancelled : no node available)",
1081 crm_str(stop_node_uname), stopped_mon->uuid);
1087 crm_notice(
" Start recurring %s (%us) for %s on %s", stopped_mon->task,
1088 interval_ms / 1000, rsc->
id,
crm_str(stop_node_uname));
1100 xmlNode *operation = NULL;
1102 for (operation = __xml_first_child_element(rsc->
ops_xml);
1104 operation = __xml_next_element(operation)) {
1106 if (
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
1107 RecurringOp_Stopped(rsc, start, node, operation, data_set);
1122 pe_rsc_trace(rsc,
"Processing migration actions %s moving from %s to %s . partial migration = %s",
1127 if (partial == FALSE) {
1135 if ((migrate_to && migrate_from) || (migrate_from && partial)) {
1207 gboolean need_stop = FALSE;
1208 bool need_promote = FALSE;
1209 gboolean is_moving = FALSE;
1213 unsigned int num_all_active = 0;
1214 unsigned int num_clean_active = 0;
1215 bool multiply_active = FALSE;
1230 pe_rsc_trace(rsc,
"Processing state transition for %s %p: %s->%s", rsc->
id, rsc,
1245 DeleteRsc(rsc, dangling_source, FALSE, data_set);
1249 if ((num_all_active == 2) && (num_clean_active == 2) && chosen
1259 "Will attempt to continue with a partial migration to target %s from %s",
1271 multiply_active = (num_clean_active > 1);
1273 multiply_active = (num_all_active > 1);
1276 if (multiply_active) {
1279 crm_notice(
"Resource %s can no longer migrate to %s. Stopping on %s too",
1285 pe_proc_err(
"Resource %s is active on %u nodes (%s)",
1286 rsc->
id, num_all_active,
1288 crm_notice(
"See https://wiki.clusterlabs.org/wiki/FAQ#Resource_is_Too_Active for more information");
1299 allow_migrate = FALSE;
1319 need_promote = TRUE;
1346 rsc->
id, need_stop ?
" required" :
"");
1347 if (
rsc_action_matrix[role][next_role] (rsc, current, !need_stop, data_set) == FALSE) {
1355 bool required = need_stop;
1362 rsc->
id, (required?
" required" :
""));
1364 data_set) == FALSE) {
1375 if (
rsc_action_matrix[role][next_role] (rsc, chosen, FALSE, data_set) == FALSE) {
1382 pe_rsc_trace(rsc,
"No monitor additional ops for blocked resource");
1387 Recurring(rsc, start, chosen, data_set);
1388 Recurring_Stopped(rsc, start, chosen, data_set);
1390 pe_rsc_trace(rsc,
"Monitor ops for inactive resource");
1391 Recurring_Stopped(rsc, NULL, NULL, data_set);
1398 pe_rsc_trace(rsc,
"Not allowing partial migration to continue. %s", rsc->
id);
1399 allow_migrate = FALSE;
1401 }
else if (is_moving == FALSE ||
1408 allow_migrate = FALSE;
1411 if (allow_migrate) {
1412 handle_migration_actions(rsc, current, chosen, data_set);
1419 GHashTableIter iter;
1422 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
1423 if (node->details->remote_rsc) {
1446 GList *allowed_nodes = NULL;
1449 allowed_nodes = g_hash_table_get_values(rsc->
allowed_nodes);
1455 return allowed_nodes;
1464 GList *allowed_nodes = NULL;
1465 bool check_unfencing = FALSE;
1466 bool check_utilization = FALSE;
1470 "Skipping native constraints for unmanaged resource: %s",
1483 check_utilization = (g_hash_table_size(rsc->
utilization) > 0)
1510 if (check_unfencing || check_utilization || rsc->
container) {
1511 allowed_nodes = allowed_nodes_as_list(rsc, data_set);
1514 if (check_unfencing) {
1517 for (GList *item = allowed_nodes; item; item = item->next) {
1521 crm_debug(
"Ordering any stops of %s before %s, and any starts after",
1540 NULL, strdup(unfence->
uuid), unfence,
1550 if (check_utilization) {
1553 pe_rsc_trace(rsc,
"Creating utilization constraints for %s - strategy: %s",
1556 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
1563 if (load_stopped->
node == NULL) {
1569 NULL, load_stopped_task, load_stopped,
pe_order_load, data_set);
1572 for (GList *item = allowed_nodes; item; item = item->next) {
1578 if (load_stopped->
node == NULL) {
1590 free(load_stopped_task);
1605 rsc_avoids_remote_nodes(rsc->
container);
1635 for (GList *item = allowed_nodes; item; item = item->next) {
1650 crm_trace(
"Order and colocate %s relative to its container %s",
1678 rsc_avoids_remote_nodes(rsc);
1680 g_list_free(allowed_nodes);
1688 if (rsc_lh == NULL) {
1689 pe_err(
"rsc_lh was NULL for %s", constraint->
id);
1692 }
else if (constraint->
rsc_rh == NULL) {
1693 pe_err(
"rsc_rh was NULL for %s", constraint->
id);
1697 if (constraint->
score == 0) {
1700 pe_rsc_trace(rsc_lh,
"Processing colocation constraint between %s and %s", rsc_lh->
id,
1710 if (constraint->
score == 0) {
1740 if ((rh_node == NULL)
1742 crm_err(
"%s must be colocated with %s but is not (%s vs. %s)",
1743 rsc_lh->
id, rsc_rh->
id,
1751 if ((rh_node != NULL)
1753 crm_err(
"%s and %s must be anti-colocated but are allocated "
1754 "to the same node (%s)",
1761 if (constraint->
score > 0
1763 crm_trace(
"LH: Skipping constraint: \"%s\" state filter nextrole is %s",
1768 if (constraint->
score > 0
1774 if (constraint->
score < 0
1776 crm_trace(
"LH: Skipping negative constraint: \"%s\" state filter",
1781 if (constraint->
score < 0
1783 crm_trace(
"RH: Skipping negative constraint: \"%s\" state filter",
1794 const char *rh_value = NULL;
1795 const char *lh_value = NULL;
1797 int score_multiplier = 1;
1799 if (constraint->
score == 0) {
1825 score_multiplier = -1;
1836 const char *value = NULL;
1837 GHashTable *work = NULL;
1838 GHashTableIter iter;
1841 if (constraint->
score == 0) {
1851 }
else if (constraint->
score < 0) {
1858 g_hash_table_iter_init(&iter, work);
1859 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
1862 constraint->
id, rsc_lh->
id, node->details->uname,
1863 constraint->
score, rsc_rh->
id);
1869 constraint->
id, rsc_lh->
id,
1870 node->details->uname, constraint->
score);
1876 constraint->
id, rsc_lh->
id, node->details->uname,
1877 constraint->
score, attribute);
1890 "%s: Rolling back scores from %s (no available nodes)",
1891 rsc_lh->
id, rsc_rh->
id);
1895 g_hash_table_destroy(work);
1909 pe_rsc_trace(rsc_lh,
"%s %s with %s (%s, score=%d, filter=%d)",
1910 ((constraint->
score >= 0)?
"Colocating" :
"Anti-colocating"),
1911 rsc_lh->
id, rsc_rh->
id, constraint->
id, constraint->
score, filter_results);
1913 switch (filter_results) {
1915 influence_priority(rsc_lh, rsc_rh, constraint);
1918 colocation_match(rsc_lh, rsc_rh, constraint);
1930 pe_rsc_trace(rsc_lh,
"LH: Skipping constraint: \"%s\" state filter",
1941 if (rsc_ticket == NULL) {
1942 pe_err(
"rsc_ticket was NULL");
1946 if (rsc_lh == NULL) {
1947 pe_err(
"rsc_lh was NULL for %s", rsc_ticket->
id);
1958 pe_rsc_trace(rsc_lh,
"Processing ticket dependencies from %s", rsc_lh->
id);
1960 for (; gIter != NULL; gIter = gIter->next) {
1968 pe_rsc_trace(rsc_lh,
"%s: Processing ticket dependency on %s (%s, %s)",
1990 if (filter_rsc_ticket(rsc_lh, rsc_ticket) == FALSE) {
1996 for (gIter = rsc_lh->
running_on; gIter != NULL; gIter = gIter->next) {
1999 pe_fence_node(data_set, node,
"deadman ticket was lost", FALSE);
2004 if (filter_rsc_ticket(rsc_lh, rsc_ticket) == FALSE) {
2055 const char *reason = NULL;
2078 if (reason == NULL) {
2117 crm_trace(
"Testing %s on %s (0x%.6x) with %s 0x%.6x",
2164 pe_rsc_trace(first->
rsc,
"Unset migrate runnable on %s because of %s",
2192 pe_rsc_trace(then->
rsc,
"Unset runnable on %s because %s is neither runnable or migratable", first->
uuid, then->
uuid);
2235 handle_restart_ordering(first, then, filter);
2238 if (then_flags != then->
flags) {
2241 "Then: Flags for %s on %s are now 0x%.6x (was 0x%.6x) because of %s 0x%.6x",
2251 if (first_flags != first->
flags) {
2254 "First: Flags for %s on %s are now 0x%.6x (was 0x%.6x) because of %s 0x%.6x",
2266 GHashTableIter iter;
2269 if (constraint == NULL) {
2270 pe_err(
"Constraint is NULL");
2273 }
else if (rsc == NULL) {
2274 pe_err(
"LHS of rsc_to_node (%s) is NULL", constraint->
id);
2283 pe_rsc_debug(rsc,
"Constraint (%s) is not active (role : %s vs. %s)",
2289 pe_rsc_trace(rsc,
"RHS of constraint %s is NULL", constraint->
id);
2293 for (gIter = constraint->
node_list_rh; gIter != NULL; gIter = gIter->next) {
2299 if (other_node != NULL) {
2302 other_node->details->uname, node->
weight, other_node->weight);
2310 g_hash_table_insert(rsc->
allowed_nodes, (gpointer) other_node->details->id, other_node);
2313 if (other_node->rsc_discover_mode < constraint->
discover_mode) {
2323 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
2324 pe_rsc_trace(rsc,
"%s + %s : %d", rsc->
id, node->details->uname, node->weight);
2336 for (gIter = rsc->
actions; gIter != NULL; gIter = gIter->next) {
2343 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
2346 child_rsc->
cmds->
expand(child_rsc, data_set);
2350 #define log_change(a, fmt, args...) do { \
2351 if(a && a->reason && terminal) { \
2352 printf(" * "fmt" \tdue to %s\n", ##args, a->reason); \
2353 } else if(a && a->reason) { \
2354 crm_notice(fmt" \tdue to %s", ##args, a->reason); \
2355 } else if(terminal) { \
2356 printf(" * "fmt"\n", ##args); \
2358 crm_notice(fmt, ##args); \
2362 #define STOP_SANITY_ASSERT(lineno) do { \
2363 if(current && current->details->unclean) { \
2365 } else if(stop == NULL) { \
2366 crm_err("%s:%d: No stop action exists for %s", __FUNCTION__, lineno, rsc->id); \
2367 CRM_ASSERT(stop != NULL); \
2368 } else if(is_set(stop->flags, pe_action_optional)) { \
2369 crm_err("%s:%d: Action %s is still optional", __FUNCTION__, lineno, stop->uuid); \
2370 CRM_ASSERT(is_not_set(stop->flags, pe_action_optional)); \
2378 char *reason = NULL;
2379 char *details = NULL;
2380 bool same_host = FALSE;
2381 bool same_role = FALSE;
2382 bool need_role = FALSE;
2384 static int rsc_width = 5;
2385 static int detail_width = 5;
2388 CRM_ASSERT(destination != NULL || origin != NULL);
2390 if(source == NULL) {
2394 len = strlen(rsc->
id);
2395 if(len > rsc_width) {
2396 rsc_width = len + 2;
2403 if(origin != NULL && destination != NULL && origin->
details == destination->
details) {
2411 if (need_role && (origin == NULL)) {
2415 }
else if (origin == NULL) {
2419 }
else if (need_role && (destination == NULL)) {
2423 }
else if (destination == NULL) {
2427 }
else if (need_role && same_role && same_host) {
2431 }
else if (same_role && same_host) {
2435 }
else if (need_role && same_role) {
2439 }
else if (same_role) {
2443 }
else if (same_host) {
2452 len = strlen(details);
2453 if(len > detail_width) {
2460 }
else if(source->
reason) {
2464 reason = strdup(
" blocked");
2467 reason = strdup(
"");
2471 printf(
" * %-8s %-*s ( %*s ) %s\n", change, rsc_width, rsc->
id, detail_width, details, reason);
2473 crm_notice(
" * %-8s %-*s ( %*s ) %s", change, rsc_width, rsc->
id, detail_width, details, reason);
2494 gboolean moving = FALSE;
2505 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
2515 current = pe__current_node(rsc);
2531 || (current == NULL && next == NULL)) {
2543 if (possible_matches) {
2544 start = possible_matches->data;
2545 g_list_free(possible_matches);
2551 start_node = current;
2554 if (possible_matches) {
2555 stop = possible_matches->data;
2556 g_list_free(possible_matches);
2560 if (possible_matches) {
2561 promote = possible_matches->data;
2562 g_list_free(possible_matches);
2566 if (possible_matches) {
2567 demote = possible_matches->data;
2568 g_list_free(possible_matches);
2575 if (possible_matches) {
2576 migrate_op = possible_matches->data;
2582 LogAction(
"Migrate", rsc, current, next, start, NULL, terminal);
2585 LogAction(
"Reload", rsc, current, next, start, NULL, terminal);
2589 if ((demote != NULL) && (promote != NULL)
2592 LogAction(
"Re-promote", rsc, current, next, promote, demote,
2600 LogAction(
"Stop", rsc, current, NULL, stop,
2601 (stop && stop->
reason)? stop : start, terminal);
2604 }
else if (moving && current) {
2606 rsc, current, next, stop, NULL, terminal);
2609 LogAction(
"Recover", rsc, current, NULL, stop, NULL, terminal);
2613 LogAction(
"Restart", rsc, current, next, start, NULL, terminal);
2617 g_list_free(possible_matches);
2628 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
2633 if (possible_matches) {
2634 stop_op = possible_matches->data;
2635 g_list_free(possible_matches);
2642 LogAction(
"Stop", rsc, node, NULL, stop_op,
2643 (stop_op && stop_op->reason)? stop_op : start, terminal);
2651 LogAction(
"Recover", rsc, current, next, stop, start, terminal);
2654 }
else if (moving) {
2655 LogAction(
"Move", rsc, current, next, stop, NULL, terminal);
2659 LogAction(
"Reload", rsc, current, next, start, NULL, terminal);
2662 LogAction(
"Restart", rsc, current, next, start, NULL, terminal);
2667 LogAction(
"Demote", rsc, current, next, demote, NULL, terminal);
2671 LogAction(
"Promote", rsc, current, next, promote, NULL, terminal);
2674 LogAction(
"Start", rsc, current, next, start, NULL, terminal);
2686 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
2713 DeleteRsc(rsc, current, optional, data_set);
2720 if (!node_has_been_unfenced(current)) {
2740 if (is_unfence_device(rsc, data_set)
2751 if (!node_has_been_unfenced(node)) {
2785 gboolean runnable = TRUE;
2794 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
2801 g_list_free(action_list);
2812 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
2818 g_list_free(action_list);
2831 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
2864 }
else if (node == NULL) {
2865 pe_rsc_trace(rsc,
"Resource %s not deleted: NULL node", rsc->
id);
2869 pe_rsc_trace(rsc,
"Resource %s not deleted from %s: unrunnable", rsc->
id,
2898 static const char *rc_master = NULL;
2899 static const char *rc_inactive = NULL;
2901 if (rc_inactive == NULL) {
2908 pe_rsc_trace(rsc,
"Skipping active resource detection for %s", rsc->
id);
2917 "Skipping probe for %s on %s because Pacemaker Remote nodes cannot run stonith agents",
2923 "Skipping probe for %s on %s because guest nodes cannot run resources containing guest nodes",
2926 }
else if (rsc->is_remote_node) {
2928 "Skipping probe for %s on %s because Pacemaker Remote nodes cannot host remote connections",
2936 gboolean any_created = FALSE;
2938 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
2941 any_created = child_rsc->
cmds->
create_probe(child_rsc, node, complete, force, data_set)
2966 if (allowed == NULL) {
3027 pe_rsc_trace(rsc,
"Skipping probe for %s on node %s, %s is stopped",
3048 pe_rsc_trace(rsc,
"Skipping probe for %s on node %s, %s is stopping, restarting or moving",
3068 if (running == NULL) {
3078 if (is_unfence_device(rsc, data_set) || !pe_rsc_is_clone(top)) {
3102 if (!is_unfence_device(rsc, data_set)) {
3131 && pe_rsc_is_anon_clone(rsc->
parent)
3159 for (gIter = rsc->
actions; gIter != NULL; gIter = gIter->next) {
3174 && !rsc_is_known_on(rsc,
target)) {
3200 bool order_implicit =
false;
3219 order_implicit =
true;
3222 if (action_list && order_implicit) {
3226 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
3231 __FUNCTION__, __LINE__);
3233 if (order_implicit) {
3235 __FUNCTION__, __LINE__);
3249 if (!pe_rsc_is_bundled(rsc)) {
3256 crm_notice(
"Stop of failed resource %s is implicit %s %s is fenced",
3257 rsc->
id, (order_implicit?
"after" :
"because"),
3260 crm_info(
"%s is implicit %s %s is fenced",
3261 action->uuid, (order_implicit?
"after" :
"because"),
3321 g_list_free(action_list);
3326 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
3329 if (
action->node->details->online == FALSE ||
action->node->details->unclean == TRUE
3334 "Demote of failed resource %s is implicit after %s is fenced",
3337 pe_rsc_info(rsc,
"%s is implicit after %s is fenced",
3345 __FUNCTION__, __LINE__);
3347 if (pe_rsc_is_bundled(rsc)) {
3350 }
else if (order_implicit) {
3356 g_list_free(action_list);
3365 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
3372 pe_rsc_trace(rsc,
"Skipping fencing constraints for unmanaged resource: %s", rsc->
id);
3375 native_start_constraints(rsc, stonith_op, data_set);
3376 native_stop_constraints(rsc, stonith_op, data_set);
3387 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
3406 pe_rsc_trace(rsc,
"%s: preventing reload because failed", rsc->
id);
3413 pe_rsc_trace(rsc,
"%s: preventing reload because start pending", rsc->
id);
3417 }
else if (node == NULL) {
3460 for (parent = rsc; parent != NULL; parent = parent->
parent) {