20 #define INFINITY_HACK (INFINITY * -100)
22 #define VARIANT_NATIVE 1
80 gboolean result = FALSE;
97 best = g_list_nth_data(nodes, 0);
100 if (prefer && nodes) {
103 if (chosen == NULL) {
104 pe_rsc_trace(rsc,
"Preferred node %s for %s was unknown",
114 pe_rsc_trace(rsc,
"Preferred node %s for %s was unsuitable",
119 pe_rsc_trace(rsc,
"Preferred node %s for %s was unavailable",
125 "Chose preferred node %s for %s (ignoring %d candidates)",
130 if ((chosen == NULL) && nodes) {
136 pe_rsc_trace(rsc,
"Chose node %s for %s from %d candidates",
139 if (!pe_rsc_is_unique_clone(rsc->
parent)
150 node_t *running = pe__current_node(rsc);
153 pe_rsc_trace(rsc,
"Current node for %s (%s) can't run resources",
155 }
else if (running) {
156 for (GList *iter = nodes->next; iter; iter = iter->next) {
174 static char score[33];
175 int log_level = (chosen->
weight >=
INFINITY)? LOG_WARNING : LOG_INFO;
179 "Chose node %s for %s from %d nodes with score %s",
189 node_list_attr_score(GHashTable * list,
const char *attr,
const char *value)
194 const char *best_node = NULL;
200 g_hash_table_iter_init(&iter, list);
201 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
202 int weight = node->weight;
207 if (weight > best_score || best_node == NULL) {
212 best_node = node->details->uname;
218 crm_info(
"Best score for %s=%s was %s with %d",
219 attr, value, best_node ? best_node :
"<none>", best_score);
226 node_hash_update(GHashTable * list1, GHashTable * list2,
const char *attr,
float factor,
227 gboolean only_positive)
238 g_hash_table_iter_init(&iter, list1);
239 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
244 if(node == NULL) {
continue; };
248 weight_f = factor * score;
251 weight = (int)(weight_f < 0 ? weight_f - 0.5 : weight_f + 0.5);
255 if (factor < 0 && score < 0) {
262 crm_trace(
"%s: Filtering %d + %f*%d (factor * score)",
263 node->details->uname, node->weight, factor, score);
266 crm_trace(
"%s: Filtering %d + %f*%d (node < 0)",
267 node->details->uname, node->weight, factor, score);
269 }
else if (only_positive && new_score < 0 && node->weight > 0) {
271 crm_trace(
"%s: Filtering %d + %f*%d (score > 0)",
272 node->details->uname, node->weight, factor, score);
274 }
else if (only_positive && new_score < 0 && node->weight == 0) {
275 crm_trace(
"%s: Filtering %d + %f*%d (score == 0)",
276 node->details->uname, node->weight, factor, score);
279 crm_trace(
"%s: %d + %f*%d", node->details->uname, node->weight, factor, score);
280 node->weight = new_score;
289 GListPtr list = g_hash_table_get_values(hash);
307 GHashTable *work = NULL;
315 pe_rsc_info(rsc,
"%s: Breaking dependency loop at %s", rhs, rsc->
id);
325 while (last->next != NULL) {
340 pe_rsc_trace(rsc,
"%s: Combining scores from %d children of %s", rhs, g_list_length(iter), rsc->
id);
342 for(iter = rsc->
children; iter->next != NULL; iter = iter->next) {
354 pe_rsc_info(rsc,
"%s: Rolling back scores from %s", rhs, rsc->
id);
355 g_hash_table_destroy(work);
365 crm_trace(
"Checking %d additional colocation constraints", g_list_length(gIter));
370 while (last->next != NULL) {
374 gIter = ((
resource_t*)last->data)->rsc_cons_lhs;
375 crm_trace(
"Checking %d additional optional group colocation constraints from %s",
376 g_list_length(gIter), ((
resource_t*)last->data)->id);
380 crm_trace(
"Checking %d additional optional colocation constraints %s", g_list_length(gIter), rsc->
id);
383 for (; gIter != NULL; gIter = gIter->next) {
388 other = constraint->
rsc_rh;
390 other = constraint->
rsc_lh;
405 g_hash_table_iter_init(&iter, work);
406 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
414 g_hash_table_destroy(nodes);
422 node_has_been_unfenced(
node_t *node)
426 return unfenced && strcmp(
"0", unfenced);
444 pe_rsc_debug(rsc,
"Escalating allocation of %s to its parent: %s", rsc->
id,
454 pe_rsc_debug(rsc,
"Dependency loop detected involving %s", rsc->
id);
461 for (gIter = rsc->
rsc_cons; gIter != NULL; gIter = gIter->next) {
464 GHashTable *archive = NULL;
468 rsc->
id, constraint->
id, rsc_rh->id,
474 rsc_rh->cmds->allocate(rsc_rh, NULL, data_set);
477 pe_rsc_info(rsc,
"%s: Rolling back scores from %s", rsc->
id, rsc_rh->id);
483 g_hash_table_destroy(archive);
489 for (gIter = rsc->
rsc_cons_lhs; gIter != NULL; gIter = gIter->next) {
500 pe_rsc_trace(rsc,
"Making sure %s doesn't get allocated", rsc->
id);
507 crm_notice(
"Resource %s cannot be elevated from %s to %s: no-quorum-policy=freeze",
520 const char *reason = NULL;
524 assign_to = pe__current_node(rsc);
525 if (assign_to == NULL) {
534 pe_rsc_info(rsc,
"Unmanaged resource %s allocated to %s: %s", rsc->
id,
535 (assign_to? assign_to->
details->
uname :
"no node"), reason);
543 && native_choose_node(rsc, prefer, data_set)) {
549 pe_rsc_info(rsc,
"Resource %s cannot run anywhere", rsc->
id);
566 crm_trace(
"Setting Pacemaker Remote node %s to ONLINE",
576 crm_trace(
"Setting Pacemaker Remote node %s to SHUTDOWN (next role %s, %sallocated)",
587 is_op_dup(
resource_t *rsc,
const char *name, guint interval_ms)
589 gboolean dup = FALSE;
590 const char *
id = NULL;
591 const char *value = NULL;
592 xmlNode *operation = NULL;
593 guint interval2_ms = 0;
596 for (operation = __xml_first_child_element(rsc->
ops_xml); operation != NULL;
597 operation = __xml_next_element(operation)) {
599 if (
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
607 if (interval_ms != interval2_ms) {
617 (
"Do not use the same (name, interval) combination more than once per resource");
627 op_cannot_recur(
const char *name)
640 const char *name = NULL;
641 const char *role = NULL;
642 const char *interval_spec = NULL;
643 const char *node_uname = node? node->
details->
uname :
"n/a";
645 guint interval_ms = 0;
647 gboolean is_optional = TRUE;
660 if (interval_ms == 0) {
665 if (is_op_dup(rsc, name, interval_ms)) {
666 crm_trace(
"Not creating duplicate recurring action %s for %dms %s",
667 ID(operation), interval_ms, name);
671 if (op_cannot_recur(name)) {
672 crm_config_err(
"Ignoring %s because action '%s' cannot be recurring",
673 ID(operation), name);
679 crm_trace(
"Not creating recurring action %s for disabled resource %s",
680 ID(operation), rsc->
id);
685 pe_rsc_trace(rsc,
"Creating recurring action %s for %s in role %s on %s",
700 if (possible_matches == NULL) {
702 pe_rsc_trace(rsc,
"Marking %s mandatory: not active", key);
707 for (gIter = possible_matches; gIter != NULL; gIter = gIter->next) {
715 g_list_free(possible_matches);
721 const char *result =
"Ignoring";
724 char *after_key = NULL;
728 log_level = LOG_INFO;
729 result =
"Cancelling";
730 cancel_op =
pe_cancel_op(rsc, name, interval_ms, node, data_set);
756 do_crm_log(log_level,
"%s action %s (%s vs. %s)",
764 mon =
custom_action(rsc, key, name, node, is_optional, TRUE, data_set);
771 pe_rsc_debug(rsc,
"%s\t %s (cancelled : start un-runnable)",
772 node_uname, mon->
uuid);
776 pe_rsc_debug(rsc,
"%s\t %s (cancelled : no node available)",
777 node_uname, mon->
uuid);
781 pe_rsc_info(rsc,
" Start recurring %s (%us) for %s on %s",
782 mon->
task, interval_ms / 1000, rsc->
id, node_uname);
789 free(running_master);
794 NULL, strdup(key), mon,
798 NULL, strdup(key), mon,
819 xmlNode *operation = NULL;
821 for (operation = __xml_first_child_element(rsc->
ops_xml);
823 operation = __xml_next_element(operation)) {
825 if (
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
826 RecurringOp(rsc, start, node, operation, data_set);
837 const char *name = NULL;
838 const char *role = NULL;
839 const char *interval_spec = NULL;
840 const char *node_uname = node? node->
details->
uname :
"n/a";
842 guint interval_ms = 0;
854 if (interval_ms == 0) {
859 if (is_op_dup(rsc, name, interval_ms)) {
860 crm_trace(
"Not creating duplicate recurring action %s for %dms %s",
861 ID(operation), interval_ms, name);
865 if (op_cannot_recur(name)) {
866 crm_config_err(
"Invalid recurring action %s wth name: '%s'",
ID(operation), name);
872 crm_trace(
"Not creating recurring action %s for disabled resource %s",
873 ID(operation), rsc->
id);
880 crm_notice(
"Ignoring %s (recurring monitors for Stopped role are "
881 "not supported for anonymous clones)",
887 "Creating recurring action %s for %s in role %s on nodes where it should not be running",
893 if (possible_matches) {
896 g_list_free(possible_matches);
898 cancel_op =
pe_cancel_op(rsc, name, interval_ms, node, data_set);
907 pe_rsc_info(rsc,
"Cancel action %s (%s vs. %s) on %s",
912 for (gIter = data_set->
nodes; gIter != NULL; gIter = gIter->next) {
914 const char *stop_node_uname = stop_node->
details->
uname;
915 gboolean is_optional = TRUE;
916 gboolean probe_is_optional = TRUE;
917 gboolean stop_is_optional = TRUE;
919 char *rc_inactive = NULL;
924 if (node &&
safe_str_eq(stop_node_uname, node_uname)) {
928 pe_rsc_trace(rsc,
"Creating recurring action %s for %s on %s",
933 if (possible_matches == NULL) {
934 pe_rsc_trace(rsc,
"Marking %s mandatory on %s: not active", key,
938 pe_rsc_trace(rsc,
"Marking %s optional on %s: already active", key,
941 g_list_free(possible_matches);
944 stopped_mon =
custom_action(rsc, strdup(key), name, stop_node, is_optional, TRUE, data_set);
955 for (pIter = probes; pIter != NULL; pIter = pIter->next) {
965 if (probe_complete_ops) {
966 g_list_free(probe_complete_ops);
971 for (local_gIter = stop_ops; local_gIter != NULL; local_gIter = local_gIter->next) {
975 stop_is_optional = FALSE;
979 crm_debug(
"%s\t %s (cancelled : stop un-runnable)",
980 crm_str(stop_node_uname), stopped_mon->uuid);
986 NULL, strdup(key), stopped_mon,
993 g_list_free(stop_ops);
996 if (is_optional == FALSE && probe_is_optional && stop_is_optional
998 pe_rsc_trace(rsc,
"Marking %s optional on %s due to unmanaged",
999 key,
crm_str(stop_node_uname));
1008 pe_rsc_debug(rsc,
"%s\t %s (cancelled : no node available)",
1009 crm_str(stop_node_uname), stopped_mon->uuid);
1015 crm_notice(
" Start recurring %s (%us) for %s on %s", stopped_mon->task,
1016 interval_ms / 1000, rsc->
id,
crm_str(stop_node_uname));
1028 xmlNode *operation = NULL;
1030 for (operation = __xml_first_child_element(rsc->
ops_xml);
1032 operation = __xml_next_element(operation)) {
1034 if (
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
1035 RecurringOp_Stopped(rsc, start, node, operation, data_set);
1050 pe_rsc_trace(rsc,
"Processing migration actions %s moving from %s to %s . partial migration = %s",
1055 if (partial == FALSE) {
1061 if ((migrate_to && migrate_from) || (migrate_from && partial)) {
1124 gboolean need_stop = FALSE;
1125 gboolean is_moving = FALSE;
1129 unsigned int num_all_active = 0;
1130 unsigned int num_clean_active = 0;
1131 bool multiply_active = FALSE;
1146 pe_rsc_trace(rsc,
"Processing state transition for %s %p: %s->%s", rsc->
id, rsc,
1161 DeleteRsc(rsc, dangling_source, FALSE, data_set);
1165 if ((num_all_active == 2) && (num_clean_active == 2) && chosen
1175 "Will attempt to continue with a partial migration to target %s from %s",
1187 multiply_active = (num_clean_active > 1);
1189 multiply_active = (num_all_active > 1);
1192 if (multiply_active) {
1195 crm_notice(
"Resource %s can no longer migrate to %s. Stopping on %s too",
1201 pe_proc_err(
"Resource %s is active on %u nodes (%s)",
1202 rsc->
id, num_all_active,
1204 crm_notice(
"See https://wiki.clusterlabs.org/wiki/FAQ#Resource_is_Too_Active for more information");
1215 allow_migrate = FALSE;
1255 rsc->
id, need_stop ?
" required" :
"");
1256 if (
rsc_action_matrix[role][next_role] (rsc, current, !need_stop, data_set) == FALSE) {
1266 rsc->
id, need_stop ?
" required" :
"");
1267 if (
rsc_action_matrix[role][next_role] (rsc, chosen, !need_stop, data_set) == FALSE) {
1278 if (
rsc_action_matrix[role][next_role] (rsc, chosen, FALSE, data_set) == FALSE) {
1285 pe_rsc_trace(rsc,
"No monitor additional ops for blocked resource");
1290 Recurring(rsc, start, chosen, data_set);
1291 Recurring_Stopped(rsc, start, chosen, data_set);
1293 pe_rsc_trace(rsc,
"Monitor ops for inactive resource");
1294 Recurring_Stopped(rsc, NULL, NULL, data_set);
1301 pe_rsc_trace(rsc,
"Not allowing partial migration to continue. %s", rsc->
id);
1302 allow_migrate = FALSE;
1304 }
else if (is_moving == FALSE ||
1311 allow_migrate = FALSE;
1314 if (allow_migrate) {
1315 handle_migration_actions(rsc, current, chosen, data_set);
1322 GHashTableIter iter;
1325 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
1326 if (node->details->remote_rsc) {
1349 GList *allowed_nodes = NULL;
1352 allowed_nodes = g_hash_table_get_values(rsc->
allowed_nodes);
1358 return allowed_nodes;
1367 GList *allowed_nodes = NULL;
1368 bool check_unfencing = FALSE;
1373 "Skipping native constraints for unmanaged resource: %s",
1408 allowed_nodes = allowed_nodes_as_list(rsc, data_set);
1411 if (check_unfencing) {
1414 for (GList *item = allowed_nodes; item; item = item->next) {
1418 crm_debug(
"Ordering any stops of %s before %s, and any starts after",
1437 NULL, strdup(unfence->
uuid), unfence,
1450 pe_rsc_trace(rsc,
"Creating utilization constraints for %s - strategy: %s",
1453 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
1459 if (load_stopped->
node == NULL) {
1465 NULL, load_stopped_task, load_stopped,
pe_order_load, data_set);
1468 for (GList *item = allowed_nodes; item; item = item->next) {
1473 if (load_stopped->
node == NULL) {
1485 free(load_stopped_task);
1500 rsc_avoids_remote_nodes(rsc->
container);
1530 for (GList *item = allowed_nodes; item; item = item->next) {
1545 crm_trace(
"Order and colocate %s relative to its container %s",
1569 rsc_avoids_remote_nodes(rsc);
1571 g_list_free(allowed_nodes);
1579 if (rsc_lh == NULL) {
1580 pe_err(
"rsc_lh was NULL for %s", constraint->
id);
1583 }
else if (constraint->
rsc_rh == NULL) {
1584 pe_err(
"rsc_rh was NULL for %s", constraint->
id);
1588 pe_rsc_trace(rsc_lh,
"Processing colocation constraint between %s and %s", rsc_lh->
id,
1598 if (constraint->
score == 0) {
1628 if ((rh_node == NULL)
1630 crm_err(
"%s must be colocated with %s but is not (%s vs. %s)",
1631 rsc_lh->
id, rsc_rh->
id,
1639 if ((rh_node != NULL)
1641 crm_err(
"%s and %s must be anti-colocated but are allocated "
1642 "to the same node (%s)",
1649 if (constraint->
score > 0
1651 crm_trace(
"LH: Skipping constraint: \"%s\" state filter nextrole is %s",
1656 if (constraint->
score > 0
1662 if (constraint->
score < 0
1664 crm_trace(
"LH: Skipping negative constraint: \"%s\" state filter",
1669 if (constraint->
score < 0
1671 crm_trace(
"RH: Skipping negative constraint: \"%s\" state filter",
1682 const char *rh_value = NULL;
1683 const char *lh_value = NULL;
1685 int score_multiplier = 1;
1710 score_multiplier = -1;
1719 const char *tmp = NULL;
1720 const char *value = NULL;
1723 GHashTable *work = NULL;
1724 gboolean do_check = FALSE;
1726 GHashTableIter iter;
1737 }
else if (constraint->
score < 0) {
1746 g_hash_table_iter_init(&iter, work);
1747 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
1752 node->details->uname, constraint->
score);
1756 }
else if (do_check == FALSE || constraint->
score >=
INFINITY) {
1758 node->details->uname, constraint->
score,
1759 do_check ?
"failed" :
"unallocated");
1771 static char score[33];
1775 pe_rsc_info(rsc_lh,
"%s: Rolling back scores from %s (%d, %s)",
1776 rsc_lh->
id, rsc_rh->
id, do_check, score);
1780 g_hash_table_destroy(work);
1794 pe_rsc_trace(rsc_lh,
"%sColocating %s with %s (%s, weight=%d, filter=%d)",
1795 constraint->
score >= 0 ?
"" :
"Anti-",
1796 rsc_lh->
id, rsc_rh->
id, constraint->
id, constraint->
score, filter_results);
1798 switch (filter_results) {
1800 influence_priority(rsc_lh, rsc_rh, constraint);
1803 pe_rsc_trace(rsc_lh,
"%sColocating %s with %s (%s, weight=%d)",
1804 constraint->
score >= 0 ?
"" :
"Anti-",
1805 rsc_lh->
id, rsc_rh->
id, constraint->
id, constraint->
score);
1806 colocation_match(rsc_lh, rsc_rh, constraint);
1818 pe_rsc_trace(rsc_lh,
"LH: Skipping constraint: \"%s\" state filter",
1829 if (rsc_ticket == NULL) {
1830 pe_err(
"rsc_ticket was NULL");
1834 if (rsc_lh == NULL) {
1835 pe_err(
"rsc_lh was NULL for %s", rsc_ticket->
id);
1846 pe_rsc_trace(rsc_lh,
"Processing ticket dependencies from %s", rsc_lh->
id);
1848 for (; gIter != NULL; gIter = gIter->next) {
1856 pe_rsc_trace(rsc_lh,
"%s: Processing ticket dependency on %s (%s, %s)",
1878 if (filter_rsc_ticket(rsc_lh, rsc_ticket) == FALSE) {
1884 for (gIter = rsc_lh->
running_on; gIter != NULL; gIter = gIter->next) {
1892 if (filter_rsc_ticket(rsc_lh, rsc_ticket) == FALSE) {
1919 return action->
flags;
1943 const char *reason = NULL;
1966 if (reason == NULL) {
2005 crm_trace(
"Testing %s on %s (0x%.6x) with %s 0x%.6x",
2052 pe_rsc_trace(first->
rsc,
"Unset migrate runnable on %s because of %s",
2080 pe_rsc_trace(then->
rsc,
"Unset runnable on %s because %s is neither runnable or migratable", first->
uuid, then->
uuid);
2123 handle_restart_ordering(first, then, filter);
2126 if (then_flags != then->
flags) {
2129 "Then: Flags for %s on %s are now 0x%.6x (was 0x%.6x) because of %s 0x%.6x",
2139 if (first_flags != first->
flags) {
2142 "First: Flags for %s on %s are now 0x%.6x (was 0x%.6x) because of %s 0x%.6x",
2154 GHashTableIter iter;
2157 if (constraint == NULL) {
2158 pe_err(
"Constraint is NULL");
2161 }
else if (rsc == NULL) {
2162 pe_err(
"LHS of rsc_to_node (%s) is NULL", constraint->
id);
2171 pe_rsc_debug(rsc,
"Constraint (%s) is not active (role : %s vs. %s)",
2177 pe_rsc_trace(rsc,
"RHS of constraint %s is NULL", constraint->
id);
2181 for (gIter = constraint->
node_list_rh; gIter != NULL; gIter = gIter->next) {
2183 node_t *other_node = NULL;
2187 if (other_node != NULL) {
2190 other_node->details->uname, node->
weight, other_node->weight);
2197 g_hash_table_insert(rsc->
allowed_nodes, (gpointer) other_node->details->id, other_node);
2200 if (other_node->rsc_discover_mode < constraint->
discover_mode) {
2210 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
2211 pe_rsc_trace(rsc,
"%s + %s : %d", rsc->
id, node->details->uname, node->weight);
2223 for (gIter = rsc->
actions; gIter != NULL; gIter = gIter->next) {
2226 crm_trace(
"processing action %d for rsc=%s", action->
id, rsc->
id);
2230 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
2233 child_rsc->
cmds->
expand(child_rsc, data_set);
2237 #define log_change(a, fmt, args...) do { \
2238 if(a && a->reason && terminal) { \
2239 printf(" * "fmt" \tdue to %s\n", ##args, a->reason); \
2240 } else if(a && a->reason) { \
2241 crm_notice(fmt" \tdue to %s", ##args, a->reason); \
2242 } else if(terminal) { \
2243 printf(" * "fmt"\n", ##args); \
2245 crm_notice(fmt, ##args); \
2249 #define STOP_SANITY_ASSERT(lineno) do { \
2250 if(current && current->details->unclean) { \
2252 } else if(stop == NULL) { \
2253 crm_err("%s:%d: No stop action exists for %s", __FUNCTION__, lineno, rsc->id); \
2254 CRM_ASSERT(stop != NULL); \
2255 } else if(is_set(stop->flags, pe_action_optional)) { \
2256 crm_err("%s:%d: Action %s is still optional", __FUNCTION__, lineno, stop->uuid); \
2257 CRM_ASSERT(is_not_set(stop->flags, pe_action_optional)); \
2261 static int rsc_width = 5;
2262 static int detail_width = 5;
2267 char *reason = NULL;
2268 char *details = NULL;
2269 bool same_host = FALSE;
2270 bool same_role = FALSE;
2271 bool need_role = FALSE;
2274 CRM_ASSERT(destination != NULL || origin != NULL);
2276 if(source == NULL) {
2280 len = strlen(rsc->
id);
2281 if(len > rsc_width) {
2282 rsc_width = len + 2;
2289 if(origin != NULL && destination != NULL && origin->
details == destination->
details) {
2297 if(need_role && origin == NULL) {
2301 }
else if(need_role && destination == NULL) {
2305 }
else if(origin == NULL || destination == NULL) {
2309 }
else if(need_role && same_role && same_host) {
2313 }
else if(same_role && same_host) {
2317 }
else if(same_role && need_role) {
2321 }
else if(same_role) {
2325 }
else if(same_host) {
2334 len = strlen(details);
2335 if(len > detail_width) {
2342 }
else if(source->
reason) {
2346 reason = strdup(
" blocked");
2349 reason = strdup(
"");
2353 printf(
" * %-8s %-*s ( %*s ) %s\n", change, rsc_width, rsc->
id, detail_width, details, reason);
2355 crm_notice(
" * %-8s %-*s ( %*s ) %s", change, rsc_width, rsc->
id, detail_width, details, reason);
2376 gboolean moving = FALSE;
2387 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
2397 current = pe__current_node(rsc);
2413 || (current == NULL && next == NULL)) {
2425 if (possible_matches) {
2426 start = possible_matches->data;
2427 g_list_free(possible_matches);
2433 start_node = current;
2436 if (possible_matches) {
2437 stop = possible_matches->data;
2438 g_list_free(possible_matches);
2442 if (possible_matches) {
2443 promote = possible_matches->data;
2444 g_list_free(possible_matches);
2448 if (possible_matches) {
2449 demote = possible_matches->data;
2450 g_list_free(possible_matches);
2457 if (possible_matches) {
2458 migrate_op = possible_matches->data;
2464 LogAction(
"Migrate", rsc, current, next, start, NULL, terminal);
2467 LogAction(
"Reload", rsc, current, next, start, NULL, terminal);
2474 LogAction(
"Stop", rsc, current, NULL, stop,
2475 (stop && stop->
reason)? stop : start, terminal);
2478 }
else if (moving && current) {
2480 rsc, current, next, stop, NULL, terminal);
2483 LogAction(
"Recover", rsc, current, NULL, stop, NULL, terminal);
2487 LogAction(
"Restart", rsc, current, next, start, NULL, terminal);
2491 g_list_free(possible_matches);
2502 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
2507 if (possible_matches) {
2508 stop_op = possible_matches->data;
2509 g_list_free(possible_matches);
2516 LogAction(
"Stop", rsc, node, NULL, stop_op,
2517 (stop_op && stop_op->reason)? stop_op : start, terminal);
2524 LogAction(
"Recover", rsc, current, next, stop, start, terminal);
2527 }
else if (moving) {
2528 LogAction(
"Move", rsc, current, next, stop, NULL, terminal);
2532 LogAction(
"Reload", rsc, current, next, start, NULL, terminal);
2535 LogAction(
"Restart", rsc, current, next, start, NULL, terminal);
2540 LogAction(
"Demote", rsc, current, next, demote, NULL, terminal);
2544 LogAction(
"Promote", rsc, current, next, promote, NULL, terminal);
2547 LogAction(
"Start", rsc, current, next, start, NULL, terminal);
2559 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
2586 DeleteRsc(rsc, current, optional, data_set);
2593 if (!node_has_been_unfenced(current)) {
2613 if (is_unfence_device(rsc, data_set)
2624 if (!node_has_been_unfenced(node)) {
2658 gboolean runnable = TRUE;
2667 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
2674 g_list_free(action_list);
2685 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
2691 g_list_free(action_list);
2704 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
2737 }
else if (node == NULL) {
2738 pe_rsc_trace(rsc,
"Resource %s not deleted: NULL node", rsc->
id);
2742 pe_rsc_trace(rsc,
"Resource %s not deleted from %s: unrunnable", rsc->
id,
2771 static const char *rc_master = NULL;
2772 static const char *rc_inactive = NULL;
2774 if (rc_inactive == NULL) {
2781 pe_rsc_trace(rsc,
"Skipping active resource detection for %s", rsc->
id);
2790 "Skipping probe for %s on %s because Pacemaker Remote nodes cannot run stonith agents",
2796 "Skipping probe for %s on %s because guest nodes cannot run resources containing guest nodes",
2799 }
else if (rsc->is_remote_node) {
2801 "Skipping probe for %s on %s because Pacemaker Remote nodes cannot host remote connections",
2809 gboolean any_created = FALSE;
2811 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
2814 any_created = child_rsc->
cmds->
create_probe(child_rsc, node, complete, force, data_set)
2839 if (allowed == NULL) {
2898 pe_rsc_trace(rsc,
"Skipping probe for %s on node %s, %s is stopped",
2919 pe_rsc_trace(rsc,
"Skipping probe for %s on node %s, %s is stopping, restarting or moving",
2939 if (running == NULL) {
2949 if (is_unfence_device(rsc, data_set) || !pe_rsc_is_clone(top)) {
2973 if (!is_unfence_device(rsc, data_set)) {
3002 && pe_rsc_is_anon_clone(rsc->
parent)
3028 target = stonith_op->
node;
3030 for (gIter = rsc->
actions; gIter != NULL; gIter = gIter->next) {
3033 switch (action->
needs) {
3045 && !rsc_is_known_on(rsc, target)) {
3071 bool order_implicit =
false;
3078 target = stonith_op->
node;
3090 order_implicit =
true;
3093 if (action_list && order_implicit) {
3097 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
3102 __FUNCTION__, __LINE__);
3104 if (order_implicit) {
3106 __FUNCTION__, __LINE__);
3120 if (!pe_rsc_is_bundled(rsc)) {
3127 crm_notice(
"Stop of failed resource %s is implicit %s %s is fenced",
3128 rsc->
id, (order_implicit?
"after" :
"because"),
3131 crm_info(
"%s is implicit %s %s is fenced",
3132 action->
uuid, (order_implicit?
"after" :
"because"),
3192 g_list_free(action_list);
3197 for (gIter = action_list; gIter != NULL; gIter = gIter->next) {
3205 "Demote of failed resource %s is implicit after %s is fenced",
3208 pe_rsc_info(rsc,
"%s is implicit after %s is fenced",
3216 __FUNCTION__, __LINE__);
3218 if (pe_rsc_is_bundled(rsc)) {
3221 }
else if (order_implicit) {
3227 g_list_free(action_list);
3236 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
3243 pe_rsc_trace(rsc,
"Skipping fencing constraints for unmanaged resource: %s", rsc->
id);
3246 native_start_constraints(rsc, stonith_op, data_set);
3247 native_stop_constraints(rsc, stonith_op, data_set);
3258 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
3278 }
else if (node == NULL) {
3321 for (parent = rsc; parent != NULL; parent = parent->
parent) {