12 #include <sys/param.h>
121 static unsigned long calls = 0;
122 gboolean changed = FALSE;
127 action->
flags = crm_clear_bit(source, line, action->
uuid, action->
flags, flags);
129 action->
flags = crm_set_bit(source, line, action->
uuid, action->
flags, flags);
132 if (last != action->
flags) {
138 crm_trace(
"%s on %s: %sset flags 0x%.6x (was 0x%.6x, now 0x%.6x, %lu, %s)",
140 clear ?
"un-" :
"", flags, last, action->
flags, calls, source);
151 gboolean force_restart = FALSE;
152 gboolean delete_resource = FALSE;
153 gboolean changed = FALSE;
155 const char *value = NULL;
156 const char *old_value = NULL;
158 const char *attr_list[] = {
164 for (; attr_lpc <
DIMOF(attr_list); attr_lpc++) {
167 if (value == old_value
175 force_restart = TRUE;
176 crm_notice(
"Forcing restart of %s on %s, %s changed: %s -> %s",
185 delete_resource = TRUE;
187 }
else if (changed) {
188 delete_resource = TRUE;
190 return delete_resource;
197 guint interval_ms = 0;
200 const char *task = NULL;
201 const char *call_id = NULL;
211 rsc->
id, task, interval_ms,
212 active_node->
details->
uname, (reason? reason :
"unknown"));
214 cancel =
pe_cancel_op(rsc, task, interval_ms, active_node, data_set);
224 guint interval_ms = 0;
226 gboolean did_change = FALSE;
229 const char *digest_secure = NULL;
231 CRM_CHECK(active_node != NULL,
return FALSE);
234 if (interval_ms > 0) {
235 xmlNode *op_match = NULL;
244 CancelXmlOp(rsc, xml_op, active_node,
"orphan", data_set);
248 }
else if (op_match == NULL) {
283 " on %s changed: %s\n",
295 required =
custom_action(rsc, key, task, NULL, TRUE, TRUE, data_set);
299 trigger_unfencing(rsc, active_node,
"Device parameters changed", NULL, data_set);
306 trigger_unfencing(rsc, active_node,
"Device parameters changed (reload)", NULL, data_set);
310 if (interval_ms > 0) {
318 op =
custom_action(rsc, key, task, active_node, TRUE, TRUE, data_set);
322 }
else if (digest_restart) {
323 pe_rsc_trace(rsc,
"Reloading '%s' action for resource %s", task, rsc->
id);
331 pe_rsc_trace(rsc,
"Resource %s doesn't know how to reload", rsc->
id);
336 required =
custom_action(rsc, key, task, NULL, TRUE, TRUE, data_set);
355 const char *reason = NULL;
360 if (check_action_definition(rsc, node, rsc_op, data_set)
364 reason =
"action definition changed";
370 switch (digest_data->
rc) {
372 crm_trace(
"Resource %s history entry %s on %s has no digest to compare",
378 reason =
"resource parameters have changed";
397 const char *task = NULL;
399 xmlNode *rsc_op = NULL;
408 || pe_rsc_is_clone(parent) == FALSE
410 pe_rsc_trace(rsc,
"Skipping param check for %s and deleting: orphan", rsc->
id);
413 pe_rsc_trace(rsc,
"Skipping param check for %s (orphan clone)", rsc->
id);
418 if (check_rsc_parameters(rsc, node, rsc_entry, FALSE, data_set)) {
421 pe_rsc_trace(rsc,
"Skipping param check for %s: no longer active on %s",
428 if (check_rsc_parameters(rsc, node, rsc_entry, TRUE, data_set)) {
432 for (rsc_op = __xml_first_child_element(rsc_entry); rsc_op != NULL;
433 rsc_op = __xml_next_element(rsc_op)) {
436 op_list = g_list_prepend(op_list, rsc_op);
443 for (gIter = sorted_op_list; gIter != NULL; gIter = gIter->next) {
444 xmlNode *rsc_op = (xmlNode *) gIter->data;
445 guint interval_ms = 0;
449 if (start_index < stop_index) {
452 }
else if (offset < start_index) {
460 if ((interval_ms > 0) &&
463 CancelXmlOp(rsc, rsc_op, node,
"maintenance mode", data_set);
465 }
else if ((interval_ms > 0)
486 }
else if (check_action_definition(rsc, node, rsc_op, data_set)
494 g_list_free(sorted_op_list);
502 gboolean match = FALSE;
509 if (data_set == NULL) {
512 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
515 result = find_rsc_list(result, child,
id, renamed_clones, partial,
522 if (strstr(rsc->
id,
id)) {
530 if (strcmp(rsc->
id,
id) == 0) {
539 result = g_list_prepend(result, rsc);
544 for (; gIter != NULL; gIter = gIter->next) {
547 result = find_rsc_list(result, child,
id, renamed_clones, partial, NULL);
557 const char *
id = NULL;
559 xmlNode *lrm_rscs = NULL;
562 xmlNode *node_state = NULL;
564 for (node_state = __xml_first_child_element(status); node_state != NULL;
565 node_state = __xml_next_element(node_state)) {
578 crm_trace(
"Skipping param check for %s: can't run resources",
585 xmlNode *rsc_entry = NULL;
587 for (rsc_entry = __xml_first_child_element(lrm_rscs);
589 rsc_entry = __xml_next_element(rsc_entry)) {
596 const char *rsc_id =
ID(rsc_entry);
600 result = find_rsc_list(NULL, NULL, rsc_id, TRUE, FALSE, data_set);
601 for (gIter = result; gIter != NULL; gIter = gIter->next) {
607 check_actions_for(rsc_entry, rsc, node, data_set);
622 gIter != NULL; gIter = gIter->next) {
654 int fail_count, countdown;
671 if (fail_count <= 0) {
684 if (countdown == 0) {
686 crm_warn(
"Forcing %s away from %s after %d failures (max=%d)",
690 crm_info(
"%s can fail %d more times on %s before being forced off",
701 for (; gIter != NULL; gIter = gIter->next) {
704 common_apply_stickiness(child_rsc, node, data_set);
714 if (current == NULL) {
720 pe_rsc_debug(sticky_rsc,
"Resource %s: preferring current location"
721 " (node=%s, weight=%d)", sticky_rsc->
id,
727 pe_rsc_debug(rsc,
"Ignoring stickiness for %s: the cluster is asymmetric"
728 " and node %s is not explicitly allowed", rsc->
id, node->
details->
uname);
730 while (g_hash_table_iter_next(&iter, NULL, (
void **)&nIter)) {
747 if (failcount_clear_action_exists(node, rsc) == FALSE) {
748 check_migration_threshold(rsc, node, data_set);
757 rsc->
cmds = &resource_class_alloc_functions[rsc->
variant];
759 for (; gIter != NULL; gIter = gIter->next) {
772 for (; gIter != NULL; gIter = gIter->next) {
780 calculate_system_health(gpointer gKey, gpointer gValue, gpointer user_data)
782 const char *key = (
const char *)gKey;
783 const char *value = (
const char *)gValue;
784 int *system_health = (
int *)user_data;
786 if (!gKey || !gValue || !user_data) {
808 if (health_strategy == NULL ||
safe_str_eq(health_strategy,
"none")) {
815 }
else if (
safe_str_eq(health_strategy,
"migrate-on-red")) {
824 }
else if (
safe_str_eq(health_strategy,
"only-green")) {
833 }
else if (
safe_str_eq(health_strategy,
"progressive")) {
840 }
else if (
safe_str_eq(health_strategy,
"custom")) {
849 crm_err(
"Unknown node health strategy: %s", health_strategy);
853 crm_info(
"Applying automated node health strategy: %s", health_strategy);
855 for (gIter = data_set->
nodes; gIter != NULL; gIter = gIter->next) {
856 int system_health = base_health;
860 g_hash_table_foreach(node->
details->
attrs, calculate_system_health, &system_health);
862 crm_info(
" Node %s has an combined system health of %d",
868 if (system_health != 0) {
872 for (; gIter2 != NULL; gIter2 = gIter2->next) {
875 rsc2node_new(health_strategy, rsc, system_health, NULL, node, data_set);
888 if (data_set->
input == NULL) {
898 apply_system_health(data_set);
912 for (
GListPtr gIter = data_set->
nodes; gIter != NULL; gIter = gIter->next) {
921 pe_fence_node(data_set, node,
"the connection is unrecoverable", FALSE);
933 if (probed != NULL &&
crm_is_true(probed) == FALSE) {
941 for (
GListPtr gIter2 = data_set->
resources; gIter2 != NULL; gIter2 = gIter2->next) {
961 for (; gIter != NULL; gIter = gIter->next) {
963 rsc_discover_filter(child_rsc, node);
995 for (GList *item = rsc->
children; item != NULL;
1019 "Cancelling shutdown lock because %s is already active",
1027 }
else if (pcmk__list_of_1(rsc->
running_on)) {
1032 pe_rsc_debug(rsc,
"Not locking %s to unclean %s for shutdown",
1036 rsc->
lock_time = shutdown_time(node, data_set);
1049 pe_rsc_info(rsc,
"Locking %s to %s due to shutdown (expires @%lld)",
1051 (
long long) lock_expiration);
1054 pe_rsc_info(rsc,
"Locking %s to %s due to shutdown",
1059 for (GList *item = data_set->
nodes; item != NULL; item = item->next) {
1082 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
1083 apply_shutdown_lock((
pe_resource_t *) gIter->data, data_set);
1089 for (gIter = data_set->
nodes; gIter != NULL; gIter = gIter->next) {
1099 crm_trace(
"Applying placement constraints");
1100 apply_placement_constraints(data_set);
1102 gIter = data_set->
nodes;
1103 for (; gIter != NULL; gIter = gIter->next) {
1108 for (; gIter2 != NULL; gIter2 = gIter2->next) {
1111 common_apply_stickiness(rsc, node, data_set);
1112 rsc_discover_filter(rsc, node);
1128 for (; gIter != NULL; gIter = gIter->next) {
1143 check_actions(data_set);
1148 convert_const_pointer(
const void *ptr)
1155 sort_rsc_process_order(gconstpointer a, gconstpointer b, gpointer
data)
1161 const char *reason =
"existence";
1170 GHashTable *r1_nodes = NULL;
1171 GHashTable *r2_nodes = NULL;
1173 reason =
"priority";
1177 if (r1_weight > r2_weight) {
1182 if (r1_weight < r2_weight) {
1187 reason =
"no node list";
1188 if (nodes == NULL) {
1193 resource1->
id, NULL, NULL, 1,
1198 resource2->
id, NULL, NULL, 1,
1203 reason =
"current location";
1208 r1_node = pe__current_node(resource1);
1209 r1_node = g_hash_table_lookup(r1_nodes, r1_node->
details->
id);
1210 if (r1_node != NULL) {
1211 r1_weight = r1_node->
weight;
1215 r2_node = pe__current_node(resource2);
1216 r2_node = g_hash_table_lookup(r2_nodes, r2_node->
details->
id);
1217 if (r2_node != NULL) {
1218 r2_weight = r2_node->
weight;
1222 if (r1_weight > r2_weight) {
1227 if (r1_weight < r2_weight) {
1233 for (gIter = nodes; gIter != NULL; gIter = gIter->next) {
1241 r1_node = g_hash_table_lookup(r1_nodes, node->
details->
id);
1244 r1_weight = r1_node->
weight;
1249 r2_node = g_hash_table_lookup(r2_nodes, node->
details->
id);
1252 r2_weight = r2_node->
weight;
1255 if (r1_weight > r2_weight) {
1260 if (r1_weight < r2_weight) {
1267 crm_trace(
"%s (%d) on %s %c %s (%d) on %s: %s",
1268 resource1->
id, r1_weight, r1_node ? r1_node->
details->
id :
"n/a",
1269 rc < 0 ? '>
' : rc > 0 ? '<
' : '=
',
1270 resource2->id, r2_weight, r2_node ? r2_node->details->id : "n/a", reason);
1273 g_hash_table_destroy(r1_nodes);
1276 g_hash_table_destroy(r2_nodes);
1283 allocate_resources(pe_working_set_t * data_set)
1285 GListPtr gIter = NULL;
1287 if (is_set(data_set->flags, pe_flag_have_remote_nodes)) {
1288 /* Allocate remote connection resources first (which will also allocate
1289 * any colocation dependencies). If the connection is migrating, always
1290 * prefer the partial migration target.
1292 for (gIter = data_set->resources; gIter != NULL; gIter = gIter->next) {
1293 pe_resource_t *rsc = (pe_resource_t *) gIter->data;
1294 if (rsc->is_remote_node == FALSE) {
1297 pe_rsc_trace(rsc, "Allocating remote connection resource '%s
'",
1299 rsc->cmds->allocate(rsc, rsc->partial_migration_target, data_set);
1303 /* now do the rest of the resources */
1304 for (gIter = data_set->resources; gIter != NULL; gIter = gIter->next) {
1305 pe_resource_t *rsc = (pe_resource_t *) gIter->data;
1306 if (rsc->is_remote_node == TRUE) {
1309 pe_rsc_trace(rsc, "Allocating %s resource '%s
'",
1310 crm_element_name(rsc->xml), rsc->id);
1311 rsc->cmds->allocate(rsc, NULL, data_set);
1315 /* We always use pe_order_preserve with these convenience functions to exempt
1316 * internally generated constraints from the prohibition of user constraints
1317 * involving remote connection resources.
1319 * The start ordering additionally uses pe_order_runnable_left so that the
1320 * specified action is not runnable if the start is not runnable.
1324 order_start_then_action(pe_resource_t *lh_rsc, pe_action_t *rh_action,
1325 enum pe_ordering extra, pe_working_set_t *data_set)
1327 if (lh_rsc && rh_action && data_set) {
1328 custom_action_order(lh_rsc, start_key(lh_rsc), NULL,
1329 rh_action->rsc, NULL, rh_action,
1330 pe_order_preserve | pe_order_runnable_left | extra,
1336 order_action_then_stop(pe_action_t *lh_action, pe_resource_t *rh_rsc,
1337 enum pe_ordering extra, pe_working_set_t *data_set)
1339 if (lh_action && rh_rsc && data_set) {
1340 custom_action_order(lh_action->rsc, NULL, lh_action,
1341 rh_rsc, stop_key(rh_rsc), NULL,
1342 pe_order_preserve | extra, data_set);
1346 // Clear fail counts for orphaned rsc on all online nodes
1348 cleanup_orphans(pe_resource_t * rsc, pe_working_set_t * data_set)
1350 GListPtr gIter = NULL;
1352 for (gIter = data_set->nodes; gIter != NULL; gIter = gIter->next) {
1353 pe_node_t *node = (pe_node_t *) gIter->data;
1355 if (node->details->online
1356 && pe_get_failcount(node, rsc, NULL, pe_fc_effective, NULL,
1359 pe_action_t *clear_op = NULL;
1361 clear_op = pe__clear_failcount(rsc, node, "it is orphaned",
1364 /* We can't use order_action_then_stop() here because its
1385 g_list_sort_with_data(data_set->
resources, sort_rsc_process_order, nodes);
1390 gIter = data_set->
nodes;
1391 for (; gIter != NULL; gIter = gIter->next) {
1400 allocate_resources(data_set);
1402 gIter = data_set->
nodes;
1403 for (; gIter != NULL; gIter = gIter->next) {
1454 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
1461 cleanup_orphans(rsc, data_set);
1468 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
1487 for (; gIter != NULL; gIter = gIter->next) {
1490 if (is_managed(child_rsc)) {
1504 for (; gIter != NULL; gIter = gIter->next) {
1507 if (is_managed(rsc)) {
1534 const char *fence_action =
"off";
1543 fence_action =
"reboot";
1550 stonith_op =
pe_fence_op(node, fence_action, FALSE,
"guest is unclean", FALSE, data_set);
1552 __FUNCTION__, __LINE__);
1560 crm_info(
"Implying guest node %s is down (action %d) after %s fencing",
1568 crm_info(
"Implying guest node %s is down (action %d) "
1569 "after container %s is stopped (action %d)",
1571 container->
id, stop->
id);
1585 crm_info(
"Implying guest node %s is down (action %d) "
1586 "after connection is stopped (action %d)",
1592 crm_info(
"Implying guest node %s is down (action %d) ",
1609 gboolean integrity_lost = FALSE;
1610 gboolean need_stonith = TRUE;
1613 GList *shutdown_ops = NULL;
1621 crm_trace(
"Creating remote ordering constraints");
1622 apply_remote_node_ordering(data_set);
1624 crm_trace(
"Processing fencing and shutdown cases");
1625 if (any_managed_resources(data_set) == FALSE) {
1626 crm_notice(
"Delaying fencing operations until there are resources to manage");
1627 need_stonith = FALSE;
1631 for (gIter = data_set->
nodes; gIter != NULL; gIter = gIter->next) {
1640 fence_guest(node, data_set);
1650 stonith_op =
pe_fence_op(node, NULL, FALSE,
"node is unclean", FALSE, data_set);
1657 dc_down = stonith_op;
1662 && (stonith_ops != NULL)) {
1673 stonith_ops = g_list_prepend(stonith_ops, stonith_op);
1689 shutdown_ops = g_list_prepend(shutdown_ops, down_op);
1694 integrity_lost = TRUE;
1699 if (integrity_lost) {
1701 pe_warn(
"YOUR RESOURCES ARE NOW LIKELY COMPROMISED");
1702 pe_err(
"ENABLE STONITH TO KEEP YOUR RESOURCES SAFE");
1705 crm_notice(
"Cannot fence unclean nodes until quorum is"
1706 " attained (or no-quorum-policy is set to ignore)");
1710 if (dc_down != NULL) {
1719 for (gIter = shutdown_ops; gIter != NULL; gIter = gIter->next) {
1722 crm_debug(
"Ordering shutdown on %s before %s on DC %s",
1736 for (gIter = stonith_ops; gIter != NULL; gIter = gIter->next) {
1740 }
else if (stonith_ops) {
1750 g_list_free(stonith_ops);
1751 g_list_free(shutdown_ops);
1772 guint interval_ms = 0;
1774 if (
parse_op_key(original_key, NULL, &task, &interval_ms)) {
1779 crm_err(
"search key: %s", original_key);
1803 crm_trace(
"Processing RH of ordering constraint %d", order->
id);
1805 if (rh_action != NULL) {
1806 rh_actions = g_list_prepend(NULL, rh_action);
1808 }
else if (rsc != NULL) {
1812 if (rh_actions == NULL) {
1813 pe_rsc_trace(rsc,
"No RH-Side (%s/%s) found for constraint..."
1828 for (; gIter != NULL; gIter = gIter->next) {
1836 crm_warn(
"Unrunnable %s 0x%.6x", rh_action_iter->
uuid, type);
1838 crm_warn(
"neither %s 0x%.6x", rh_action_iter->
uuid, type);
1842 g_list_free(rh_actions);
1854 crm_trace(
"Processing LH of ordering constraint %d", order->
id);
1857 if (lh_action != NULL) {
1858 lh_actions = g_list_prepend(NULL, lh_action);
1864 if (lh_actions == NULL && lh_rsc != rh_rsc) {
1866 char *op_type = NULL;
1867 guint interval_ms = 0;
1874 pe_rsc_trace(lh_rsc,
"No LH-Side (%s/%s) found for constraint %d with %s - ignoring",
1879 pe_rsc_trace(lh_rsc,
"No LH-Side (%s/%s) found for constraint %d with %s - ignoring",
1883 pe_rsc_trace(lh_rsc,
"No LH-Side (%s/%s) found for constraint %d with %s - creating",
1885 lh_action =
custom_action(lh_rsc, key, op_type, NULL, TRUE, TRUE, data_set);
1886 lh_actions = g_list_prepend(NULL, lh_action);
1893 for (; gIter != NULL; gIter = gIter->next) {
1896 if (rh_rsc == NULL && order->
rh_action) {
1900 rsc_order_then(lh_action_iter, rh_rsc, order);
1907 g_list_free(lh_actions);
1923 return (interval_ms > 0);
1954 crm_trace(
"Order %s action %s relative to %s%s for %s%s",
2006 if (is_recurring_action(action)) {
2012 order_start_then_action(remote_rsc, action,
2034 cluster_node = pe__current_node(remote_rsc);
2074 }
else if (cluster_node == NULL) {
2083 }
else if (pcmk__list_of_multiple(remote_rsc->
running_on)
2109 if (action->
rsc == NULL) {
2119 crm_trace(
"Order %s action %s relative to %s%s (state: %s)",
2122 remote_rsc->
id, state2text(state));
2143 order_start_then_action(remote_rsc, action, order_opts, data_set);
2148 order_action_then_stop(action, remote_rsc,
2158 pe_fence_node(data_set, action->
node,
"resources are active and the connection is unrecoverable", FALSE);
2165 order_action_then_stop(action, remote_rsc,
2172 order_start_then_action(remote_rsc, action,
pe_order_none, data_set);
2189 if (is_recurring_action(action)) {
2194 order_start_then_action(remote_rsc, action,
2198 pe_node_t *cluster_node = pe__current_node(remote_rsc);
2206 pe_fence_node(data_set, action->
node,
"resources are in an unknown state and the connection is unrecoverable", FALSE);
2217 order_action_then_stop(action, remote_rsc,
2236 for (
GListPtr gIter = data_set->
actions; gIter != NULL; gIter = gIter->next) {
2241 if (action->
rsc == NULL) {
2265 if (action->
node == NULL) {
2284 if (remote == NULL) {
2295 for (GList *item = action->
rsc->
actions; item != NULL;
2296 item = item->next) {
2302 action->
rsc, NULL, rsc_action,
2317 if (remote->container) {
2319 apply_container_ordering(action, data_set);
2323 apply_remote_ordering(action, data_set);
2339 const char *op = g_hash_table_lookup(rh_action->
meta,
"stonith_action");
2376 if (lh_rsc == NULL) {
2379 }
else if (rh_rsc && lh_rsc == rh_rsc) {
2383 if (lh_action == NULL && lh_action_task == NULL) {
2387 if (rh_action == NULL && rh_action_task == NULL) {
2398 }
else if (lh_action == NULL
2408 if (rh_rsc && lh_rsc->
container == rh_rsc) {
2412 }
else if (rh_action == NULL && rh_action_task
2434 order_type = order->
type;
2438 if (probes == NULL) {
2443 rh_actions = g_list_prepend(rh_actions, rh_action);
2445 }
else if (rh_rsc && rh_action_task) {
2449 if (rh_actions == NULL) {
2450 g_list_free(probes);
2454 crm_trace(
"Processing for LH probe based on ordering constraint %s -> %s"
2455 " (id=%d, type=%.6x)",
2456 lh_action ? lh_action->
uuid : lh_action_task,
2457 rh_action ? rh_action->
uuid : rh_action_task,
2460 for (pIter = probes; pIter != NULL; pIter = pIter->next) {
2464 for (rIter = rh_actions; rIter != NULL; rIter = rIter->next) {
2467 if (order_first_probe_unneeded(probe, rh_action_iter)) {
2474 g_list_free(rh_actions);
2475 g_list_free(probes);
2480 order_first_probe_then_restart_repromote(
pe_action_t * probe,
2485 bool interleave = FALSE;
2489 || probe->
rsc == NULL
2506 crm_trace(
"Processing based on %s %s -> %s %s",
2518 && probe->
rsc != after->
rsc) {
2530 for (gIter = then_actions; gIter != NULL; gIter = gIter->next) {
2540 g_list_free(then_actions);
2545 const char *interleave_s = g_hash_table_lookup(after->
rsc->
meta,
2561 for (gIter = after->
actions_after; gIter != NULL; gIter = gIter->next) {
2580 if (after->
rsc == NULL
2593 && interleave == TRUE
2594 && (compatible_rsc == NULL
2595 || compatible_rsc != after_wrapper->
action->
rsc)) {
2600 crm_trace(
"Proceeding through %s %s -> %s %s (type=0x%.6x)",
2605 after_wrapper->
type);
2607 order_first_probe_then_restart_repromote(probe, after_wrapper->
action, data_set);
2615 for (gIter = data_set->
actions; gIter != NULL; gIter = gIter->next) {
2630 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
2633 order_first_rsc_probes(child, data_set);
2642 for (gIter = probes; gIter != NULL; gIter= gIter->next) {
2646 for (aIter = probe->
actions_after; aIter != NULL; aIter = aIter->next) {
2649 order_first_probe_then_restart_repromote(probe, after_wrapper->
action, data_set);
2650 clear_actions_tracking_flag(data_set);
2654 g_list_free(probes);
2662 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
2665 order_first_rsc_probes(rsc, data_set);
2668 order_first_probes_imply_stops(data_set);
2677 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
2729 start = actions->data;
2730 g_list_free(actions);
2734 crm_err(
"No start action for %s", rsc->
id);
2740 for (actions = start->actions_before; actions != NULL; actions = actions->next) {
2747 if(first->required_runnable_before) {
2749 for (clone_actions = first->actions_before; clone_actions != NULL; clone_actions = clone_actions->next) {
2760 crm_trace(
"Not a start op %s for %s", first->uuid, start->uuid);
2763 if(first_rsc == NULL) {
2767 crm_trace(
"Same parent %s for %s", first_rsc->id, start->uuid);
2770 }
else if(FALSE && pe_rsc_is_clone(
uber_parent(first_rsc)) == FALSE) {
2771 crm_trace(
"Not a clone %s for %s", first_rsc->id, start->uuid);
2775 crm_err(
"Applying %s before %s %d", first->uuid, start->uuid,
uber_parent(first_rsc)->variant);
2777 for (pIter = probes; pIter != NULL; pIter = pIter->next) {
2780 crm_err(
"Ordering %s before %s", first->uuid, probe->
uuid);
2791 order_first_probes(data_set);
2792 order_then_probes(data_set);
2798 GList *gIter = NULL;
2800 crm_trace(
"Applying ordering constraints");
2814 crm_trace(
"Applying ordering constraint: %d", order->
id);
2818 rsc_order_first(rsc, order, data_set);
2825 rsc_order_then(order->
lh_action, rsc, order);
2833 for (gIter = data_set->
actions; gIter != NULL; gIter = gIter->next) {
2840 order_probes(data_set);
2843 for (gIter = data_set->
actions; gIter != NULL; gIter = gIter->next) {
2850 for (gIter = data_set->
actions; gIter != NULL; gIter = gIter->next) {
2855 input_iter != NULL; input_iter = input_iter->next) {
2865 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
2873 static int transition_id = -1;
2885 crm_err(
"Calculated transition %d (with errors), saving inputs in %s",
2886 transition_id, filename);
2889 crm_warn(
"Calculated transition %d (with warnings), saving inputs in %s",
2890 transition_id, filename);
2893 crm_notice(
"Calculated transition %d, saving inputs in %s",
2894 transition_id, filename);
2897 crm_notice(
"Configuration errors found during scheduler processing,"
2898 " please run \"crm_verify -L\" to identify issues");
2909 const char *value = NULL;
2912 crm_trace(
"Creating transition graph %d.", transition_id);
2941 char *recheck_epoch = NULL;
2946 free(recheck_epoch);
2963 for (; gIter != NULL; gIter = gIter->next) {
2976 crm_trace(
"processing non-resource actions");
2979 for (; gIter != NULL; gIter = gIter->next) {
2996 crm_crit(
"Cannot %s node '%s' because of %s:%s%s (%s)",
3009 crm_trace(
"Created transition graph %d.", transition_id);
3019 for (gIter = data_set->
actions; gIter != NULL; gIter = gIter->next) {
3020 char *node_name = NULL;
3024 if (action->
rsc != NULL) {
3032 }
else if(action->
node) {
3038 task = strdup(
"Shutdown");
3040 const char *op = g_hash_table_lookup(action->
meta,
"stonith_action");
3046 }
else if(terminal && action->
reason) {
3047 printf(
" * %s %s '%s'\n", task, node_name, action->
reason);
3048 }
else if(terminal) {
3049 printf(
" * %s %s\n", task, node_name);
3050 }
else if(action->
reason) {
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)
void pe__foreach_param_check(pe_working_set_t *data_set, void(*cb)(pe_resource_t *, pe_node_t *, xmlNode *, enum pe_check_parameters, pe_working_set_t *))
#define CRM_CHECK(expr, failure_action)
xmlNode * find_xml_node(xmlNode *cib, const char *node_path, gboolean must_find)
void group_append_meta(pe_resource_t *rsc, xmlNode *xml)
enum pe_action_flags clone_action_flags(pe_action_t *action, pe_node_t *node)
enum pe_quorum_policy no_quorum_policy
void clone_append_meta(pe_resource_t *rsc, xmlNode *xml)
void pcmk__order_vs_fence(pe_action_t *stonith_op, pe_working_set_t *data_set)
gboolean parse_op_key(const char *key, char **rsc_id, char **op_type, guint *interval_ms)
#define crm_notice(fmt, args...)
#define CRMD_ACTION_MIGRATED
#define pe_flag_stop_action_orphans
gboolean(* create_probe)(pe_resource_t *, pe_node_t *, pe_action_t *, gboolean, pe_working_set_t *)
enum pe_action_flags pcmk__bundle_action_flags(pe_action_t *action, pe_node_t *node)
#define pe_rsc_debug(rsc, fmt, args...)
#define XML_CONFIG_ATTR_SHUTDOWN_LOCK
#define crm_crit(fmt, args...)
gboolean safe_str_neq(const char *a, const char *b)
gboolean stage2(pe_working_set_t *data_set)
gboolean stage5(pe_working_set_t *data_set)
gboolean stage3(pe_working_set_t *data_set)
#define XML_ATTR_TRANSITION_MAGIC
enum rsc_role_e(* state)(const pe_resource_t *, gboolean)
GList * sort_nodes_by_weight(GList *nodes, pe_node_t *active_node, pe_working_set_t *data_set)
#define stop_action(rsc, node, optional)
void complex_set_cmds(pe_resource_t *rsc)
void pe__add_param_check(xmlNode *rsc_op, pe_resource_t *rsc, pe_node_t *node, enum pe_check_parameters, pe_working_set_t *data_set)
pe_resource_t * container
pe_node_t * partial_migration_source
#define pe_flag_concurrent_fencing
void pe__update_recheck_time(time_t recheck, pe_working_set_t *data_set)
void pcmk__log_transition_summary(const char *filename)
#define XML_CIB_TAG_CONSTRAINTS
resource_alloc_functions_t * cmds
#define pe_flag_symmetric_cluster
bool pcmk__ordering_is_invalid(pe_action_t *action, pe_action_wrapper_t *input)
xmlNode * get_object_root(const char *object_type, xmlNode *the_root)
void clone_rsc_colocation_lh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, rsc_colocation_t *constraint, pe_working_set_t *data_set)
#define pe_flag_no_compat
gboolean stage0(pe_working_set_t *data_set)
int pcmk__guint_from_hash(GHashTable *table, const char *key, guint default_val, guint *result)
enum rsc_role_e next_role
#define pe__show_node_weights(level, rsc, text, nodes)
void add_maintenance_update(pe_working_set_t *data_set)
const char * crm_xml_add_int(xmlNode *node, const char *name, int value)
Create an XML attribute with specified name and integer value.
gboolean exclusive_discover
int char2score(const char *score)
pe_resource_t * remote_rsc
pe_action_t * sched_shutdown_op(pe_node_t *node, pe_working_set_t *data_set)
resource_alloc_functions_t resource_class_alloc_functions[]
resource_object_functions_t * fns
gboolean pe__is_guest_or_remote_node(pe_node_t *node)
#define XML_LRM_TAG_RESOURCE
void pe_action_set_flag_reason(const char *function, long line, pe_action_t *action, pe_action_t *reason, const char *text, enum pe_action_flags flags, bool overwrite)
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
void ReloadRsc(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set)
int crm_parse_int(const char *text, const char *default_text)
Parse an integer value from a string.
void pcmk__bundle_rsc_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, rsc_colocation_t *constraint, pe_working_set_t *data_set)
gint sort_op_by_callid(gconstpointer a, gconstpointer b)
gboolean unpack_constraints(xmlNode *xml_constraints, pe_working_set_t *data_set)
#define pe_flag_have_status
void group_rsc_location(pe_resource_t *rsc, pe__location_t *constraint)
enum action_tasks text2task(const char *task)
time_t get_effective_time(pe_working_set_t *data_set)
const char * pe_pref(GHashTable *options, const char *name)
void resource_location(pe_resource_t *rsc, pe_node_t *node, int score, const char *tag, pe_working_set_t *data_set)
enum pe_graph_flags native_update_actions(pe_action_t *first, pe_action_t *then, pe_node_t *node, enum pe_action_flags flags, enum pe_action_flags filter, enum pe_ordering type, pe_working_set_t *data_set)
void native_expand(pe_resource_t *rsc, pe_working_set_t *data_set)
#define clear_bit(word, bit)
void native_rsc_location(pe_resource_t *rsc, pe__location_t *constraint)
pe_node_t * partial_migration_target
GHashTable * pcmk__native_merge_weights(pe_resource_t *rsc, const char *rhs, GHashTable *nodes, const char *attr, float factor, uint32_t flags)
gboolean remote_was_fenced
gboolean can_run_resources(const pe_node_t *node)
#define pe_flag_have_quorum
bool pe__bundle_needs_remote_name(pe_resource_t *rsc)
#define CRM_SCORE_INFINITY
gboolean remote_requires_reset
pe_node_t * pe_find_node_id(GListPtr node_list, const char *id)
void trigger_unfencing(pe_resource_t *rsc, pe_node_t *node, const char *reason, pe_action_t *dependency, pe_working_set_t *data_set)
gboolean pe__is_remote_node(pe_node_t *node)
#define CRM_TRACE_INIT_DATA(name)
#define CRMD_ACTION_START
void group_rsc_colocation_lh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, rsc_colocation_t *constraint, pe_working_set_t *data_set)
void native_rsc_colocation_lh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, rsc_colocation_t *constraint, pe_working_set_t *data_set)
GListPtr placement_constraints
#define XML_LRM_ATTR_TASK
pe__location_t * rsc2node_new(const char *id, pe_resource_t *rsc, int weight, const char *discovery_mode, pe_node_t *node, pe_working_set_t *data_set)
void native_internal_constraints(pe_resource_t *rsc, pe_working_set_t *data_set)
#define CRM_OP_CLEAR_FAILCOUNT
gboolean crm_config_error
#define pe_flag_have_remote_nodes
#define crm_warn(fmt, args...)
guint remote_reconnect_ms
void LogActions(pe_resource_t *rsc, pe_working_set_t *data_set, gboolean terminal)
void native_create_actions(pe_resource_t *rsc, pe_working_set_t *data_set)
#define set_bit(word, bit)
void(* create_actions)(pe_resource_t *, pe_working_set_t *)
void clone_expand(pe_resource_t *rsc, pe_working_set_t *data_set)
int crm_element_value_ms(const xmlNode *data, const char *name, guint *dest)
Retrieve the millisecond value of an XML attribute.
#define crm_debug(fmt, args...)
gboolean stage8(pe_working_set_t *data_set)
pe_resource_t * uber_parent(pe_resource_t *rsc)
#define pe_flag_sanitized
gboolean pe__resource_is_remote_conn(pe_resource_t *rsc, pe_working_set_t *data_set)
pe_node_t * pcmk__clone_allocate(pe_resource_t *rsc, pe_node_t *preferred, pe_working_set_t *data_set)
#define XML_CIB_ATTR_SHUTDOWN
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
#define XML_CIB_TAG_STATE
enum pe_graph_flags group_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)
#define pe_rsc_start_pending
gboolean stage4(pe_working_set_t *data_set)
void group_rsc_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, rsc_colocation_t *constraint, pe_working_set_t *data_set)
gboolean update_action(pe_action_t *action, pe_working_set_t *data_set)
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...)
enum rsc_digest_cmp_val rc
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 * digest_secure_calc
void calculate_active_ops(GList *sorted_op_list, int *start_index, int *stop_index)
GListPtr find_actions(GListPtr input, const char *key, const pe_node_t *on_node)
struct pe_node_shared_s * details
bool pe__shutdown_requested(pe_node_t *node)
#define XML_AGENT_ATTR_PROVIDER
gboolean order_actions(pe_action_t *lh_action, pe_action_t *rh_action, enum pe_ordering order)
GHashTable * pcmk__group_merge_weights(pe_resource_t *rsc, const char *rhs, GHashTable *nodes, const char *attr, float factor, uint32_t flags)
Wrappers for and extensions to libxml2.
#define XML_ATTR_TE_NOWAIT
xmlNode * find_rsc_op_entry(pe_resource_t *rsc, const char *key)
void(* expand)(pe_resource_t *, pe_working_set_t *)
void LogNodeActions(pe_working_set_t *data_set, gboolean terminal)
xmlNode * create_xml_node(xmlNode *parent, const char *name)
#define pe_flag_stonith_enabled
const char * pe_node_attribute_raw(pe_node_t *node, const char *name)
gboolean native_create_probe(pe_resource_t *rsc, pe_node_t *node, pe_action_t *complete, gboolean force, pe_working_set_t *data_set)
#define XML_LRM_ATTR_RESTART_DIGEST
gboolean update_action_flags(pe_action_t *action, enum pe_action_flags flags, const char *source, int line)
void group_internal_constraints(pe_resource_t *rsc, pe_working_set_t *data_set)
pe_node_t * pcmk__bundle_allocate(pe_resource_t *rsc, pe_node_t *preferred, pe_working_set_t *data_set)
enum pe_obj_types variant
gboolean xml_has_children(const xmlNode *root)
gboolean crm_str_eq(const char *a, const char *b, gboolean use_case)
const char * placement_strategy
void(* rsc_location)(pe_resource_t *, pe__location_t *)
void pe__free_param_checks(pe_working_set_t *data_set)
char * pcmk__op_key(const char *rsc_id, const char *op_type, guint interval_ms)
Generate an operation key (RESOURCE_ACTION_INTERVAL)
gboolean pcmk__bundle_create_probe(pe_resource_t *rsc, pe_node_t *node, pe_action_t *complete, gboolean force, pe_working_set_t *data_set)
GListPtr ordering_constraints
bool pe_can_fence(pe_working_set_t *data_set, pe_node_t *node)
pe_resource_t * find_compatible_child(pe_resource_t *local_child, pe_resource_t *rsc, enum rsc_role_e filter, gboolean current, pe_working_set_t *data_set)
#define PCMK_RESOURCE_CLASS_STONITH
gboolean rsc_discovery_enabled
#define XML_LRM_ATTR_SECURE_DIGEST
void group_create_actions(pe_resource_t *rsc, pe_working_set_t *data_set)
gboolean show_utilization
void dump_node_capacity(int level, const char *comment, pe_node_t *node)
enum pe_action_flags group_action_flags(pe_action_t *action, pe_node_t *node)
void update_colo_start_chain(pe_action_t *action, pe_working_set_t *data_set)
gboolean stage7(pe_working_set_t *data_set)
long long crm_parse_ll(const char *text, const char *default_text)
Parse a long long integer value from a string.
gboolean pe__is_guest_node(pe_node_t *node)
Cluster status and scheduling.
void add_hash_param(GHashTable *hash, const char *name, const char *value)
#define pe_set_action_bit(action, bit)
void pcmk__bundle_rsc_location(pe_resource_t *rsc, pe__location_t *constraint)
void clone_rsc_location(pe_resource_t *rsc, pe__location_t *constraint)
void clone_rsc_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, rsc_colocation_t *constraint, pe_working_set_t *data_set)
#define XML_LRM_TAG_RESOURCES
int pe__add_scores(int score1, int score2)
#define crm_err(fmt, args...)
bool pcmk__ends_with(const char *s, const char *match)
pe_action_t * pe__clear_failcount(pe_resource_t *rsc, pe_node_t *node, const char *reason, pe_working_set_t *data_set)
Schedule a controller operation to clear a fail count.
op_digest_cache_t * rsc_action_digest_cmp(pe_resource_t *rsc, xmlNode *xml_op, pe_node_t *node, pe_working_set_t *data_set)
gboolean cluster_status(pe_working_set_t *data_set)
#define pe_clear_action_bit(action, bit)
#define XML_LRM_ATTR_INTERVAL_MS
gboolean stage6(pe_working_set_t *data_set)
#define crm_log_xml_info(xml, text)
void clone_create_actions(pe_resource_t *rsc, pe_working_set_t *data_set)
#define XML_LRM_ATTR_CALLID
#define CRMD_ACTION_MIGRATE
void(* internal_constraints)(pe_resource_t *, pe_working_set_t *)
void pcmk__bundle_expand(pe_resource_t *rsc, pe_working_set_t *data_set)
gboolean clone_create_probe(pe_resource_t *rsc, pe_node_t *node, pe_action_t *complete, gboolean force, pe_working_set_t *data_set)
void native_append_meta(pe_resource_t *rsc, xmlNode *xml)
enum pe_action_flags flags
#define pe_rsc_maintenance
#define pe_rsc_failure_ignored
#define XML_CIB_TAG_STATUS
#define crm_log_xml_trace(xml, text)
gboolean crm_is_true(const char *s)
#define XML_LRM_TAG_RSC_OP
#define pe_rsc_trace(rsc, fmt, args...)
pe_action_t * find_first_action(GListPtr input, const char *uuid, const char *task, pe_node_t *on_node)
bool pcmk__starts_with(const char *str, const char *prefix)
Check whether a string starts with a certain sequence.
gboolean was_processing_error
#define safe_str_eq(a, b)
#define XML_RSC_ATTR_INTERLEAVE
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.
pe_action_t * pe__clear_resource_history(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set)
gboolean was_processing_warning
void clone_internal_constraints(pe_resource_t *rsc, pe_working_set_t *data_set)
gboolean probe_resources(pe_working_set_t *data_set)
char * crm_strdup_printf(char const *format,...) __attribute__((__format__(__printf__
#define pe_flag_start_failure_fatal
gboolean DeleteRsc(pe_resource_t *rsc, pe_node_t *node, gboolean optional, pe_working_set_t *data_set)
void group_expand(pe_resource_t *rsc, pe_working_set_t *data_set)
void pcmk__bundle_create_actions(pe_resource_t *rsc, pe_working_set_t *data_set)
void graph_element_from_action(pe_action_t *action, pe_working_set_t *data_set)
#define crm_info(fmt, args...)
enum pe_action_flags native_action_flags(pe_action_t *action, pe_node_t *node)
enum pe_graph_flags pcmk__multi_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 pcmk__bundle_internal_constraints(pe_resource_t *rsc, pe_working_set_t *data_set)
void set_alloc_actions(pe_working_set_t *data_set)
void pcmk__bundle_append_meta(pe_resource_t *rsc, xmlNode *xml)
int pe_get_failcount(pe_node_t *node, pe_resource_t *rsc, time_t *last_failure, uint32_t flags, xmlNode *xml_op, pe_working_set_t *data_set)
pe_action_t * pe_fence_op(pe_node_t *node, const char *op, bool optional, const char *reason, bool priority_delay, pe_working_set_t *data_set)
#define pe_flag_shutdown_lock
enum crm_ais_msg_types type
#define pe_rsc_info(rsc, fmt, args...)
void pcmk__bundle_rsc_colocation_lh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, rsc_colocation_t *constraint, pe_working_set_t *data_set)
void native_rsc_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, rsc_colocation_t *constraint, pe_working_set_t *data_set)
pe_node_t * pcmk__native_allocate(pe_resource_t *rsc, pe_node_t *preferred, pe_working_set_t *data_set)
#define XML_AGENT_ATTR_CLASS
GHashTable * allowed_nodes
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)
#define pe_flag_startup_probes
pe_node_t * pcmk__group_allocate(pe_resource_t *rsc, pe_node_t *preferred, pe_working_set_t *data_set)
#define pe_flag_stop_rsc_orphans