20 #define INFINITY_HACK (INFINITY * -100)
22 #define VARIANT_NATIVE 1
74 gboolean result = FALSE;
91 best = g_list_nth_data(nodes, 0);
94 if (prefer && nodes) {
98 pe_rsc_trace(rsc,
"Preferred node %s for %s was unknown",
108 pe_rsc_trace(rsc,
"Preferred node %s for %s was unsuitable",
113 pe_rsc_trace(rsc,
"Preferred node %s for %s was unavailable",
119 "Chose preferred node %s for %s (ignoring %d candidates)",
124 if ((chosen == NULL) && nodes) {
130 pe_rsc_trace(rsc,
"Chose node %s for %s from %d candidates",
133 if (!pe_rsc_is_unique_clone(rsc->
parent)
144 pe_node_t *running = pe__current_node(rsc);
147 pe_rsc_trace(rsc,
"Current node for %s (%s) can't run resources",
149 }
else if (running) {
150 for (GList *iter = nodes->next; iter; iter = iter->next) {
168 static char score[33];
169 int log_level = (chosen->
weight >=
INFINITY)? LOG_WARNING : LOG_INFO;
173 "Chose node %s for %s from %d nodes with score %s",
191 best_node_score_matching_attr(
const pe_resource_t *rsc,
const char *attr,
197 const char *best_node = NULL;
201 while (g_hash_table_iter_next(&iter, NULL, (
void **) &node)) {
206 best_score = node->weight;
207 best_node = node->details->uname;
212 if (best_node == NULL) {
213 crm_info(
"No allowed node for %s matches node attribute %s=%s",
214 rsc->
id, attr, value);
216 crm_info(
"Allowed node %s for %s had best score (%d) "
217 "of those matching node attribute %s=%s",
218 best_node, rsc->
id, best_score, attr, value);
239 add_node_scores_matching_attr(GHashTable *nodes,
const pe_resource_t *rsc,
240 const char *attr,
float factor,
251 g_hash_table_iter_init(&iter, nodes);
252 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
258 score = best_node_score_matching_attr(rsc, attr,
261 if ((factor < 0) && (score < 0)) {
267 crm_trace(
"%s: Filtering %d + %f * %d (double negative disallowed)",
268 node->details->uname, node->weight, factor, score);
273 crm_trace(
"%s: Filtering %d + %f * %d (node was marked unusable)",
274 node->details->uname, node->weight, factor, score);
278 weight_f = factor * score;
281 weight = (int) ((weight_f < 0)? (weight_f - 0.5) : (weight_f + 0.5));
287 if ((weight == 0) && (score != 0)) {
290 }
else if (factor < 0.0) {
297 if (only_positive && (new_score < 0) && (node->weight > 0)) {
298 crm_trace(
"%s: Filtering %d + %f * %d = %d "
299 "(negative disallowed, marking node unusable)",
300 node->details->uname, node->weight, factor, score,
306 if (only_positive && (new_score < 0) && (node->weight == 0)) {
307 crm_trace(
"%s: Filtering %d + %f * %d = %d (negative disallowed)",
308 node->details->uname, node->weight, factor, score,
313 crm_trace(
"%s: %d + %f * %d = %d", node->details->uname,
314 node->weight, factor, score, new_score);
315 node->weight = new_score;
342 GHashTable *nodes,
const char *attr,
float factor,
345 GHashTable *work = NULL;
349 pe_rsc_info(rsc,
"%s: Breaking dependency loop at %s", rhs, rsc->
id);
355 if (is_nonempty_group(rsc)) {
356 GList *last = g_list_last(rsc->
children);
360 "using last member %s (at %.6f)",
361 rhs, rsc->
id, last_rsc->
id, factor);
369 }
else if (is_nonempty_group(rsc)) {
380 pe_rsc_trace(rsc,
"%s: Merging scores from first member of group %s "
381 "(at %.6f)", rhs, rsc->
id, factor);
387 pe_rsc_trace(rsc,
"%s: Merging scores from %s (at %.6f)",
388 rhs, rsc->
id, factor);
390 add_node_scores_matching_attr(work, rsc, attr, factor,
396 int multiplier = (factor < 0)? -1 : 1;
401 "Checking additional %d optional '%s with' constraints",
402 g_list_length(gIter), rsc->
id);
404 }
else if (is_nonempty_group(rsc)) {
408 pe_rsc_trace(rsc,
"Checking additional %d optional 'with group %s' "
409 "constraints using last member %s",
410 g_list_length(gIter), rsc->
id, last_rsc->
id);
415 "Checking additional %d optional 'with %s' constraints",
416 g_list_length(gIter), rsc->
id);
419 for (; gIter != NULL; gIter = gIter->next) {
423 if (constraint->
score == 0) {
428 other = constraint->
rsc_rh;
430 other = constraint->
rsc_lh;
433 pe_rsc_trace(rsc,
"Optionally merging score of '%s' constraint (%s with %s)",
444 pe_rsc_info(rsc,
"%s: Rolling back optional scores from %s",
446 g_hash_table_destroy(work);
456 g_hash_table_iter_init(&iter, work);
457 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
465 g_hash_table_destroy(nodes);
477 return unfenced && strcmp(
"0", unfenced);
495 pe_rsc_debug(rsc,
"Escalating allocation of %s to its parent: %s", rsc->
id,
505 pe_rsc_debug(rsc,
"Dependency loop detected involving %s", rsc->
id);
512 for (gIter = rsc->
rsc_cons; gIter != NULL; gIter = gIter->next) {
515 GHashTable *archive = NULL;
518 if (constraint->
score == 0) {
528 "%s: Allocating %s first (constraint=%s score=%d role=%s)",
529 rsc->
id, rsc_rh->id, constraint->
id,
531 rsc_rh->cmds->allocate(rsc_rh, NULL, data_set);
534 pe_rsc_info(rsc,
"%s: Rolling back scores from %s", rsc->
id, rsc_rh->id);
540 g_hash_table_destroy(archive);
546 for (gIter = rsc->
rsc_cons_lhs; gIter != NULL; gIter = gIter->next) {
549 if (constraint->
score == 0) {
552 pe_rsc_trace(rsc,
"Merging score of '%s' constraint (%s with %s)",
563 pe_rsc_trace(rsc,
"Making sure %s doesn't get allocated", rsc->
id);
570 crm_notice(
"Resource %s cannot be elevated from %s to %s: no-quorum-policy=freeze",
582 const char *reason = NULL;
586 assign_to = pe__current_node(rsc);
587 if (assign_to == NULL) {
596 pe_rsc_info(rsc,
"Unmanaged resource %s allocated to %s: %s", rsc->
id,
597 (assign_to? assign_to->
details->
uname :
"no node"), reason);
605 && native_choose_node(rsc, prefer, data_set)) {
611 pe_rsc_info(rsc,
"Resource %s cannot run anywhere", rsc->
id);
628 crm_trace(
"Setting Pacemaker Remote node %s to ONLINE",
638 crm_trace(
"Setting Pacemaker Remote node %s to SHUTDOWN (next role %s, %sallocated)",
651 gboolean dup = FALSE;
652 const char *
id = NULL;
653 const char *value = NULL;
654 xmlNode *operation = NULL;
655 guint interval2_ms = 0;
658 for (operation = __xml_first_child_element(rsc->
ops_xml); operation != NULL;
659 operation = __xml_next_element(operation)) {
661 if (
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
669 if (interval_ms != interval2_ms) {
678 "same name and interval combination more "
679 "than once per resource)",
ID(operation),
id);
689 op_cannot_recur(
const char *
name)
702 const char *
name = NULL;
703 const char *role = NULL;
704 const char *interval_spec = NULL;
705 const char *node_uname = node? node->
details->
uname :
"n/a";
707 guint interval_ms = 0;
709 gboolean is_optional = TRUE;
722 if (interval_ms == 0) {
727 if (is_op_dup(rsc,
name, interval_ms)) {
728 crm_trace(
"Not creating duplicate recurring action %s for %dms %s",
729 ID(operation), interval_ms,
name);
733 if (op_cannot_recur(
name)) {
741 crm_trace(
"Not creating recurring action %s for disabled resource %s",
742 ID(operation), rsc->
id);
747 pe_rsc_trace(rsc,
"Creating recurring action %s for %s in role %s on %s",
762 if (possible_matches == NULL) {
764 pe_rsc_trace(rsc,
"Marking %s mandatory: not active", key);
769 for (gIter = possible_matches; gIter != NULL; gIter = gIter->next) {
777 g_list_free(possible_matches);
783 const char *result =
"Ignoring";
786 char *after_key = NULL;
790 log_level = LOG_INFO;
791 result =
"Cancelling";
818 do_crm_log(log_level,
"%s action %s (%s vs. %s)",
833 pe_rsc_debug(rsc,
"%s\t %s (cancelled : start un-runnable)",
834 node_uname, mon->
uuid);
838 pe_rsc_debug(rsc,
"%s\t %s (cancelled : no node available)",
839 node_uname, mon->
uuid);
843 pe_rsc_info(rsc,
" Start recurring %s (%us) for %s on %s",
844 mon->
task, interval_ms / 1000, rsc->
id, node_uname);
851 free(running_master);
856 NULL, strdup(key), mon,
860 NULL, strdup(key), mon,
881 xmlNode *operation = NULL;
883 for (operation = __xml_first_child_element(rsc->
ops_xml);
885 operation = __xml_next_element(operation)) {
887 if (
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
888 RecurringOp(rsc, start, node, operation, data_set);
899 const char *
name = NULL;
900 const char *role = NULL;
901 const char *interval_spec = NULL;
902 const char *node_uname = node? node->
details->
uname :
"n/a";
904 guint interval_ms = 0;
916 if (interval_ms == 0) {
921 if (is_op_dup(rsc,
name, interval_ms)) {
922 crm_trace(
"Not creating duplicate recurring action %s for %dms %s",
923 ID(operation), interval_ms,
name);
927 if (op_cannot_recur(
name)) {
935 crm_trace(
"Not creating recurring action %s for disabled resource %s",
936 ID(operation), rsc->
id);
943 crm_notice(
"Ignoring %s (recurring monitors for Stopped role are "
944 "not supported for anonymous clones)",
950 "Creating recurring action %s for %s in role %s on nodes where it should not be running",
956 if (possible_matches) {
959 g_list_free(possible_matches);
970 pe_rsc_info(rsc,
"Cancel action %s (%s vs. %s) on %s",
975 for (gIter = data_set->
nodes; gIter != NULL; gIter = gIter->next) {
977 const char *stop_node_uname = stop_node->
details->
uname;
978 gboolean is_optional = TRUE;
979 gboolean probe_is_optional = TRUE;
980 gboolean stop_is_optional = TRUE;
982 char *rc_inactive = NULL;
987 if (node &&
safe_str_eq(stop_node_uname, node_uname)) {
991 pe_rsc_trace(rsc,
"Creating recurring action %s for %s on %s",
996 if (possible_matches == NULL) {
997 pe_rsc_trace(rsc,
"Marking %s mandatory on %s: not active", key,
1001 pe_rsc_trace(rsc,
"Marking %s optional on %s: already active", key,
1004 g_list_free(possible_matches);
1007 stopped_mon =
custom_action(rsc, strdup(key),
name, stop_node, is_optional, TRUE, data_set);
1018 for (pIter = probes; pIter != NULL; pIter = pIter->next) {
1025 g_list_free(probes);
1028 if (probe_complete_ops) {
1029 g_list_free(probe_complete_ops);
1034 for (local_gIter = stop_ops; local_gIter != NULL; local_gIter = local_gIter->next) {
1038 stop_is_optional = FALSE;
1042 crm_debug(
"%s\t %s (cancelled : stop un-runnable)",
1043 crm_str(stop_node_uname), stopped_mon->uuid);
1049 NULL, strdup(key), stopped_mon,
1056 g_list_free(stop_ops);
1059 if (is_optional == FALSE && probe_is_optional && stop_is_optional
1061 pe_rsc_trace(rsc,
"Marking %s optional on %s due to unmanaged",
1062 key,
crm_str(stop_node_uname));
1071 pe_rsc_debug(rsc,
"%s\t %s (cancelled : no node available)",
1072 crm_str(stop_node_uname), stopped_mon->uuid);
1078 crm_notice(
" Start recurring %s (%us) for %s on %s", stopped_mon->task,
1079 interval_ms / 1000, rsc->
id,
crm_str(stop_node_uname));
1091 xmlNode *operation = NULL;
1093 for (operation = __xml_first_child_element(rsc->
ops_xml);
1095 operation = __xml_next_element(operation)) {
1097 if (
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
1098 RecurringOp_Stopped(rsc, start, node, operation, data_set);
1113 pe_rsc_trace(rsc,
"Processing migration actions %s moving from %s to %s . partial migration = %s",
1118 if (partial == FALSE) {
1126 if ((migrate_to && migrate_from) || (migrate_from && partial)) {
1198 gboolean need_stop = FALSE;
1199 gboolean is_moving = FALSE;
1203 unsigned int num_all_active = 0;
1204 unsigned int num_clean_active = 0;
1205 bool multiply_active = FALSE;
1220 pe_rsc_trace(rsc,
"Processing state transition for %s %p: %s->%s", rsc->
id, rsc,
1235 DeleteRsc(rsc, dangling_source, FALSE, data_set);
1239 if ((num_all_active == 2) && (num_clean_active == 2) && chosen
1249 "Will attempt to continue with a partial migration to target %s from %s",
1261 multiply_active = (num_clean_active > 1);
1263 multiply_active = (num_all_active > 1);
1266 if (multiply_active) {
1269 crm_notice(
"Resource %s can no longer migrate to %s. Stopping on %s too",
1275 pe_proc_err(
"Resource %s is active on %u nodes (%s)",
1276 rsc->
id, num_all_active,
1278 crm_notice(
"See https://wiki.clusterlabs.org/wiki/FAQ#Resource_is_Too_Active for more information");
1289 allow_migrate = FALSE;
1329 rsc->
id, need_stop ?
" required" :
"");
1330 if (
rsc_action_matrix[role][next_role] (rsc, current, !need_stop, data_set) == FALSE) {
1340 rsc->
id, need_stop ?
" required" :
"");
1341 if (
rsc_action_matrix[role][next_role] (rsc, chosen, !need_stop, data_set) == FALSE) {
1352 if (
rsc_action_matrix[role][next_role] (rsc, chosen, FALSE, data_set) == FALSE) {
1359 pe_rsc_trace(rsc,
"No monitor additional ops for blocked resource");
1364 Recurring(rsc, start, chosen, data_set);
1365 Recurring_Stopped(rsc, start, chosen, data_set);
1367 pe_rsc_trace(rsc,
"Monitor ops for inactive resource");
1368 Recurring_Stopped(rsc, NULL, NULL, data_set);
1375 pe_rsc_trace(rsc,
"Not allowing partial migration to continue. %s", rsc->
id);
1376 allow_migrate = FALSE;
1378 }
else if (is_moving == FALSE ||
1385 allow_migrate = FALSE;
1388 if (allow_migrate) {
1389 handle_migration_actions(rsc, current, chosen, data_set);
1396 GHashTableIter iter;
1399 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
1400 if (node->details->remote_rsc) {
1423 GList *allowed_nodes = NULL;
1426 allowed_nodes = g_hash_table_get_values(rsc->
allowed_nodes);
1432 return allowed_nodes;
1441 GList *allowed_nodes = NULL;
1442 bool check_unfencing = FALSE;
1443 bool check_utilization = FALSE;
1447 "Skipping native constraints for unmanaged resource: %s",
1460 check_utilization = (g_hash_table_size(rsc->
utilization) > 0)
1487 if (check_unfencing || check_utilization || rsc->
container) {
1488 allowed_nodes = allowed_nodes_as_list(rsc, data_set);
1491 if (check_unfencing) {
1494 for (GList *item = allowed_nodes; item; item = item->next) {
1498 crm_debug(
"Ordering any stops of %s before %s, and any starts after",
1517 NULL, strdup(unfence->
uuid), unfence,
1527 if (check_utilization) {
1530 pe_rsc_trace(rsc,
"Creating utilization constraints for %s - strategy: %s",
1533 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
1540 if (load_stopped->
node == NULL) {
1546 NULL, load_stopped_task, load_stopped,
pe_order_load, data_set);
1549 for (GList *item = allowed_nodes; item; item = item->next) {
1555 if (load_stopped->
node == NULL) {
1567 free(load_stopped_task);
1582 rsc_avoids_remote_nodes(rsc->
container);
1612 for (GList *item = allowed_nodes; item; item = item->next) {
1627 crm_trace(
"Order and colocate %s relative to its container %s",
1655 rsc_avoids_remote_nodes(rsc);
1657 g_list_free(allowed_nodes);
1665 if (rsc_lh == NULL) {
1666 pe_err(
"rsc_lh was NULL for %s", constraint->
id);
1669 }
else if (constraint->
rsc_rh == NULL) {
1670 pe_err(
"rsc_rh was NULL for %s", constraint->
id);
1674 if (constraint->
score == 0) {
1677 pe_rsc_trace(rsc_lh,
"Processing colocation constraint between %s and %s", rsc_lh->
id,
1687 if (constraint->
score == 0) {
1717 if ((rh_node == NULL)
1719 crm_err(
"%s must be colocated with %s but is not (%s vs. %s)",
1720 rsc_lh->
id, rsc_rh->
id,
1728 if ((rh_node != NULL)
1730 crm_err(
"%s and %s must be anti-colocated but are allocated "
1731 "to the same node (%s)",
1738 if (constraint->
score > 0
1740 crm_trace(
"LH: Skipping constraint: \"%s\" state filter nextrole is %s",
1745 if (constraint->
score > 0
1751 if (constraint->
score < 0
1753 crm_trace(
"LH: Skipping negative constraint: \"%s\" state filter",
1758 if (constraint->
score < 0
1760 crm_trace(
"RH: Skipping negative constraint: \"%s\" state filter",
1771 const char *rh_value = NULL;
1772 const char *lh_value = NULL;
1774 int score_multiplier = 1;
1776 if (constraint->
score == 0) {
1802 score_multiplier = -1;
1813 const char *value = NULL;
1814 GHashTable *work = NULL;
1815 GHashTableIter iter;
1818 if (constraint->
score == 0) {
1828 }
else if (constraint->
score < 0) {
1835 g_hash_table_iter_init(&iter, work);
1836 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
1839 constraint->
id, rsc_lh->
id, node->details->uname,
1840 constraint->
score, rsc_rh->
id);
1846 constraint->
id, rsc_lh->
id,
1847 node->details->uname, constraint->
score);
1853 constraint->
id, rsc_lh->
id, node->details->uname,
1854 constraint->
score, attribute);
1867 "%s: Rolling back scores from %s (no available nodes)",
1868 rsc_lh->
id, rsc_rh->
id);
1872 g_hash_table_destroy(work);
1886 pe_rsc_trace(rsc_lh,
"%s %s with %s (%s, score=%d, filter=%d)",
1887 ((constraint->
score >= 0)?
"Colocating" :
"Anti-colocating"),
1888 rsc_lh->
id, rsc_rh->
id, constraint->
id, constraint->
score, filter_results);
1890 switch (filter_results) {
1892 influence_priority(rsc_lh, rsc_rh, constraint);
1895 colocation_match(rsc_lh, rsc_rh, constraint);
1907 pe_rsc_trace(rsc_lh,
"LH: Skipping constraint: \"%s\" state filter",
1918 if (rsc_ticket == NULL) {
1919 pe_err(
"rsc_ticket was NULL");
1923 if (rsc_lh == NULL) {
1924 pe_err(
"rsc_lh was NULL for %s", rsc_ticket->
id);
1935 pe_rsc_trace(rsc_lh,
"Processing ticket dependencies from %s", rsc_lh->
id);
1937 for (; gIter != NULL; gIter = gIter->next) {
1945 pe_rsc_trace(rsc_lh,
"%s: Processing ticket dependency on %s (%s, %s)",
1967 if (filter_rsc_ticket(rsc_lh, rsc_ticket) == FALSE) {
1973 for (gIter = rsc_lh->
running_on; gIter != NULL; gIter = gIter->next) {
1976 pe_fence_node(data_set, node,
"deadman ticket was lost", FALSE);
1981 if (filter_rsc_ticket(rsc_lh, rsc_ticket) == FALSE) {
2032 const char *reason = NULL;
2055 if (reason == NULL) {
2094 crm_trace(
"Testing %s on %s (0x%.6x) with %s 0x%.6x",
2141 pe_rsc_trace(first->
rsc,
"Unset migrate runnable on %s because of %s",
2169 pe_rsc_trace(then->
rsc,
"Unset runnable on %s because %s is neither runnable or migratable", first->
uuid, then->
uuid);
2212 handle_restart_ordering(first, then, filter);
2215 if (then_flags != then->
flags) {
2218 "Then: Flags for %s on %s are now 0x%.6x (was 0x%.6x) because of %s 0x%.6x",
2228 if (first_flags != first->
flags) {
2231 "First: Flags for %s on %s are now 0x%.6x (was 0x%.6x) because of %s 0x%.6x",
2243 GHashTableIter iter;
2246 if (constraint == NULL) {
2247 pe_err(
"Constraint is NULL");
2250 }
else if (rsc == NULL) {
2251 pe_err(
"LHS of rsc_to_node (%s) is NULL", constraint->
id);
2260 pe_rsc_debug(rsc,
"Constraint (%s) is not active (role : %s vs. %s)",
2266 pe_rsc_trace(rsc,
"RHS of constraint %s is NULL", constraint->
id);
2270 for (gIter = constraint->
node_list_rh; gIter != NULL; gIter = gIter->next) {
2276 if (other_node != NULL) {
2279 other_node->details->uname, node->
weight, other_node->weight);
2287 g_hash_table_insert(rsc->
allowed_nodes, (gpointer) other_node->details->id, other_node);
2290 if (other_node->rsc_discover_mode < constraint->
discover_mode) {
2300 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
2301 pe_rsc_trace(rsc,
"%s + %s : %d", rsc->
id, node->details->uname, node->weight);
2313 for (gIter = rsc->
actions; gIter != NULL; gIter = gIter->next) {
2320 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
2323 child_rsc->
cmds->
expand(child_rsc, data_set);
2327 #define log_change(a, fmt, args...) do { \
2328 if(a && a->reason && terminal) { \
2329 printf(" * "fmt" \tdue to %s\n", ##args, a->reason); \
2330 } else if(a && a->reason) { \
2331 crm_notice(fmt" \tdue to %s", ##args, a->reason); \
2332 } else if(terminal) { \
2333 printf(" * "fmt"\n", ##args); \
2335 crm_notice(fmt, ##args); \
2339 #define STOP_SANITY_ASSERT(lineno) do { \
2340 if(current && current->details->unclean) { \
2342 } else if(stop == NULL) { \
2343 crm_err("%s:%d: No stop action exists for %s", __FUNCTION__, lineno, rsc->id); \
2344 CRM_ASSERT(stop != NULL); \
2345 } else if(is_set(stop->flags, pe_action_optional)) { \
2346 crm_err("%s:%d: Action %s is still optional", __FUNCTION__, lineno, stop->uuid); \
2347 CRM_ASSERT(is_not_set(stop->flags, pe_action_optional)); \
2351 static int rsc_width = 5;
2352 static int detail_width = 5;
2357 char *reason = NULL;
2358 char *details = NULL;
2359 bool same_host = FALSE;
2360 bool same_role = FALSE;
2361 bool need_role = FALSE;
2364 CRM_ASSERT(destination != NULL || origin != NULL);
2366 if(source == NULL) {
2370 len = strlen(rsc->
id);
2371 if(len > rsc_width) {
2372 rsc_width = len + 2;
2379 if(origin != NULL && destination != NULL && origin->
details == destination->
details) {
2387 if(need_role && origin == NULL) {
2391 }
else if(need_role && destination == NULL) {
2395 }
else if(origin == NULL || destination == NULL) {
2399 }
else if(need_role && same_role && same_host) {
2403 }
else if(same_role && same_host) {
2407 }
else if(same_role && need_role) {
2411 }
else if(same_role) {
2415 }
else if(same_host) {
2424 len = strlen(details);
2425 if(len > detail_width) {
2432 }
else if(source->
reason) {
2436 reason = strdup(
" blocked");
2439 reason = strdup(
"");
2443 printf(
" * %-8s %-*s ( %*s ) %s\n", change, rsc_width, rsc->
id, detail_width, details, reason);
2445 crm_notice(
" * %-8s %-*s ( %*s ) %s", change, rsc_width, rsc->
id, detail_width, details, reason);
2466 gboolean moving = FALSE;
2477 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
2487 current = pe__current_node(rsc);
2503 || (current == NULL && next == NULL)) {
2515 if (possible_matches) {
2516 start = possible_matches->data;
2517 g_list_free(possible_matches);
2523 start_node = current;
2526 if (possible_matches) {
2527 stop = possible_matches->data;
2528 g_list_free(possible_matches);
2532 if (possible_matches) {
2533 promote = possible_matches->data;
2534 g_list_free(possible_matches);
2538 if (possible_matches) {
2539 demote = possible_matches->data;
2540 g_list_free(possible_matches);
2547 if (possible_matches) {
2548 migrate_op = possible_matches->data;
2554 LogAction(
"Migrate", rsc, current, next, start, NULL, terminal);
2557 LogAction(
"Reload", rsc, current, next, start, NULL, terminal);
2564 LogAction(
"Stop", rsc, current, NULL, stop,
2565 (stop && stop->
reason)? stop : start, terminal);
2568 }
else if (moving && current) {
2570 rsc, current, next, stop, NULL, terminal);
2573 LogAction(
"Recover", rsc, current, NULL, stop, NULL, terminal);
2577 LogAction(
"Restart", rsc, current, next, start, NULL, terminal);
2581 g_list_free(possible_matches);
2592 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
2597 if (possible_matches) {
2598 stop_op = possible_matches->data;
2599 g_list_free(possible_matches);
2606 LogAction(
"Stop", rsc, node, NULL, stop_op,
2607 (stop_op && stop_op->reason)? stop_op : start, terminal);
2614 LogAction(
"Recover", rsc, current, next, stop, start, terminal);
2617 }
else if (moving) {
2618 LogAction(
"Move", rsc, current, next, stop, NULL, terminal);
2622 LogAction(
"Reload", rsc, current, next, start, NULL, terminal);
2625 LogAction(
"Restart", rsc, current, next, start, NULL, terminal);
2630 LogAction(
"Demote", rsc, current, next, demote, NULL, terminal);
2634 LogAction(
"Promote", rsc, current, next, promote, NULL, terminal);
2637 LogAction(
"Start", rsc, current, next, start, NULL, terminal);
2649 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
2676 DeleteRsc(rsc, current, optional, data_set);
2683 if (!node_has_been_unfenced(current)) {
2703 if (is_unfence_device(rsc, data_set)
2714 if (!node_has_been_unfenced(node)) {
2748 gboolean runnable = TRUE;
2757 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
2764 g_list_free(action_list);
2775 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
2781 g_list_free(action_list);
2794 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
2827 }
else if (node == NULL) {
2828 pe_rsc_trace(rsc,
"Resource %s not deleted: NULL node", rsc->
id);
2832 pe_rsc_trace(rsc,
"Resource %s not deleted from %s: unrunnable", rsc->
id,
2861 static const char *rc_master = NULL;
2862 static const char *rc_inactive = NULL;
2864 if (rc_inactive == NULL) {
2871 pe_rsc_trace(rsc,
"Skipping active resource detection for %s", rsc->
id);
2880 "Skipping probe for %s on %s because Pacemaker Remote nodes cannot run stonith agents",
2886 "Skipping probe for %s on %s because guest nodes cannot run resources containing guest nodes",
2889 }
else if (rsc->is_remote_node) {
2891 "Skipping probe for %s on %s because Pacemaker Remote nodes cannot host remote connections",
2899 gboolean any_created = FALSE;
2901 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
2904 any_created = child_rsc->
cmds->
create_probe(child_rsc, node, complete, force, data_set)
2929 if (allowed == NULL) {
2990 pe_rsc_trace(rsc,
"Skipping probe for %s on node %s, %s is stopped",
3011 pe_rsc_trace(rsc,
"Skipping probe for %s on node %s, %s is stopping, restarting or moving",
3031 if (running == NULL) {
3041 if (is_unfence_device(rsc, data_set) || !pe_rsc_is_clone(top)) {
3065 if (!is_unfence_device(rsc, data_set)) {
3094 && pe_rsc_is_anon_clone(rsc->
parent)
3122 for (gIter = rsc->
actions; gIter != NULL; gIter = gIter->next) {
3137 && !rsc_is_known_on(rsc,
target)) {
3163 bool order_implicit =
false;
3182 order_implicit =
true;
3185 if (action_list && order_implicit) {
3189 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
3194 __FUNCTION__, __LINE__);
3196 if (order_implicit) {
3198 __FUNCTION__, __LINE__);
3212 if (!pe_rsc_is_bundled(rsc)) {
3219 crm_notice(
"Stop of failed resource %s is implicit %s %s is fenced",
3220 rsc->
id, (order_implicit?
"after" :
"because"),
3223 crm_info(
"%s is implicit %s %s is fenced",
3224 action->uuid, (order_implicit?
"after" :
"because"),
3284 g_list_free(action_list);
3289 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
3292 if (
action->node->details->online == FALSE ||
action->node->details->unclean == TRUE
3297 "Demote of failed resource %s is implicit after %s is fenced",
3300 pe_rsc_info(rsc,
"%s is implicit after %s is fenced",
3308 __FUNCTION__, __LINE__);
3310 if (pe_rsc_is_bundled(rsc)) {
3313 }
else if (order_implicit) {
3319 g_list_free(action_list);
3328 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
3335 pe_rsc_trace(rsc,
"Skipping fencing constraints for unmanaged resource: %s", rsc->
id);
3338 native_start_constraints(rsc, stonith_op, data_set);
3339 native_stop_constraints(rsc, stonith_op, data_set);
3350 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
3370 }
else if (node == NULL) {
3413 for (parent = rsc; parent != NULL; parent = parent->
parent) {