12 #include <sys/param.h> 122 static unsigned long calls = 0;
123 gboolean changed = FALSE;
133 if (last !=
action->flags) {
139 crm_trace(
"%s on %s: %sset flags 0x%.6x (was 0x%.6x, now 0x%.6x, %lu, %s)",
141 clear ?
"un-" :
"",
flags, last,
action->flags, calls, source);
152 gboolean force_restart = FALSE;
153 gboolean delete_resource = FALSE;
154 gboolean changed = FALSE;
156 const char *value = NULL;
157 const char *old_value = NULL;
159 const char *attr_list[] = {
165 for (; attr_lpc <
DIMOF(attr_list); attr_lpc++) {
168 if (value == old_value
176 force_restart = TRUE;
177 crm_notice(
"Forcing restart of %s on %s, %s changed: %s -> %s",
186 delete_resource = TRUE;
188 }
else if (changed) {
189 delete_resource = TRUE;
191 return delete_resource;
198 guint interval_ms = 0;
201 const char *task = NULL;
202 const char *call_id = NULL;
212 rsc->
id, task, interval_ms,
213 active_node->
details->
uname, (reason? reason :
"unknown"));
215 cancel =
pe_cancel_op(rsc, task, interval_ms, active_node, data_set);
225 guint interval_ms = 0;
227 gboolean did_change = FALSE;
230 const char *digest_secure = NULL;
232 CRM_CHECK(active_node != NULL,
return FALSE);
235 if (interval_ms > 0) {
236 xmlNode *op_match = NULL;
244 if ((op_match == NULL)
246 CancelXmlOp(rsc, xml_op, active_node,
"orphan", data_set);
250 }
else if (op_match == NULL) {
285 " on %s changed: %s\n",
297 required =
custom_action(rsc, key, task, NULL, TRUE, TRUE, data_set);
301 trigger_unfencing(rsc, active_node,
"Device parameters changed", NULL, data_set);
308 trigger_unfencing(rsc, active_node,
"Device parameters changed (reload)", NULL, data_set);
312 if (interval_ms > 0) {
320 op =
custom_action(rsc, key, task, active_node, TRUE, TRUE, data_set);
324 }
else if (digest_restart) {
325 pe_rsc_trace(rsc,
"Reloading '%s' action for resource %s", task, rsc->
id);
333 pe_rsc_trace(rsc,
"Resource %s doesn't know how to reload", rsc->
id);
338 required =
custom_action(rsc, key, task, NULL, TRUE, TRUE, data_set);
357 const char *reason = NULL;
362 if (check_action_definition(rsc, node, rsc_op, data_set)
366 reason =
"action definition changed";
372 switch (digest_data->
rc) {
374 crm_trace(
"Resource %s history entry %s on %s has no digest to compare",
380 reason =
"resource parameters have changed";
399 const char *task = NULL;
401 xmlNode *rsc_op = NULL;
410 || pe_rsc_is_clone(parent) == FALSE
412 pe_rsc_trace(rsc,
"Skipping param check for %s and deleting: orphan", rsc->
id);
415 pe_rsc_trace(rsc,
"Skipping param check for %s (orphan clone)", rsc->
id);
420 if (check_rsc_parameters(rsc, node, rsc_entry, FALSE, data_set)) {
423 pe_rsc_trace(rsc,
"Skipping param check for %s: no longer active on %s",
430 if (check_rsc_parameters(rsc, node, rsc_entry, TRUE, data_set)) {
434 for (rsc_op = pcmk__xe_first_child(rsc_entry); rsc_op != NULL;
435 rsc_op = pcmk__xe_next(rsc_op)) {
438 op_list = g_list_prepend(op_list, rsc_op);
445 for (gIter = sorted_op_list; gIter != NULL; gIter = gIter->next) {
446 xmlNode *rsc_op = (xmlNode *) gIter->data;
447 guint interval_ms = 0;
451 if (start_index < stop_index) {
454 }
else if (offset < start_index) {
462 if ((interval_ms > 0) &&
465 CancelXmlOp(rsc, rsc_op, node,
"maintenance mode", data_set);
484 }
else if (check_action_definition(rsc, node, rsc_op, data_set)
492 g_list_free(sorted_op_list);
500 gboolean match = FALSE;
507 if (data_set == NULL) {
510 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
513 result = find_rsc_list(result, child,
id, renamed_clones, partial,
520 if (strstr(rsc->
id,
id)) {
528 if (strcmp(rsc->
id,
id) == 0) {
537 result = g_list_prepend(result, rsc);
542 for (; gIter != NULL; gIter = gIter->next) {
545 result = find_rsc_list(result, child,
id, renamed_clones, partial, NULL);
555 const char *
id = NULL;
557 xmlNode *lrm_rscs = NULL;
560 xmlNode *node_state = NULL;
562 for (node_state = pcmk__xe_first_child(status); node_state != NULL;
563 node_state = pcmk__xe_next(node_state)) {
578 crm_trace(
"Skipping param check for %s: can't run resources",
586 xmlNode *rsc_entry = NULL;
588 for (rsc_entry = pcmk__xe_first_child(lrm_rscs);
590 rsc_entry = pcmk__xe_next(rsc_entry)) {
597 const char *rsc_id =
ID(rsc_entry);
601 result = find_rsc_list(NULL, NULL, rsc_id, TRUE, FALSE, data_set);
602 for (gIter = result; gIter != NULL; gIter = gIter->next) {
608 check_actions_for(rsc_entry, rsc, node, data_set);
623 gIter != NULL; gIter = gIter->next) {
655 int fail_count, countdown;
672 if (fail_count <= 0) {
685 if (countdown == 0) {
687 crm_warn(
"Forcing %s away from %s after %d failures (max=%d)",
691 crm_info(
"%s can fail %d more times on %s before being forced off",
702 for (; gIter != NULL; gIter = gIter->next) {
705 common_apply_stickiness(child_rsc, node, data_set);
715 if (current == NULL) {
717 }
else if ((match != NULL)
722 pe_rsc_debug(sticky_rsc,
"Resource %s: preferring current location" 723 " (node=%s, weight=%d)", sticky_rsc->
id,
729 pe_rsc_debug(rsc,
"Ignoring stickiness for %s: the cluster is asymmetric" 730 " and node %s is not explicitly allowed", rsc->
id, node->
details->
uname);
732 while (g_hash_table_iter_next(&iter, NULL, (
void **)&nIter)) {
733 crm_err(
"%s[%s] = %d", rsc->
id, nIter->details->uname, nIter->weight);
749 if (failcount_clear_action_exists(node, rsc) == FALSE) {
750 check_migration_threshold(rsc, node, data_set);
761 for (; gIter != NULL; gIter = gIter->next) {
774 for (; gIter != NULL; gIter = gIter->next) {
782 calculate_system_health(gpointer gKey, gpointer gValue, gpointer user_data)
784 const char *key = (
const char *)gKey;
785 const char *value = (
const char *)gValue;
786 int *system_health = (
int *)user_data;
788 if (!gKey || !gValue || !user_data) {
817 }
else if (pcmk__str_eq(health_strategy,
"migrate-on-red",
pcmk__str_casei)) {
826 }
else if (pcmk__str_eq(health_strategy,
"only-green",
pcmk__str_casei)) {
835 }
else if (pcmk__str_eq(health_strategy,
"progressive",
pcmk__str_casei)) {
851 crm_err(
"Unknown node health strategy: %s", health_strategy);
855 crm_info(
"Applying automated node health strategy: %s", health_strategy);
857 for (gIter = data_set->
nodes; gIter != NULL; gIter = gIter->next) {
858 int system_health = base_health;
862 g_hash_table_foreach(node->
details->
attrs, calculate_system_health, &system_health);
864 crm_info(
" Node %s has an combined system health of %d",
870 if (system_health != 0) {
874 for (; gIter2 != NULL; gIter2 = gIter2->next) {
877 rsc2node_new(health_strategy, rsc, system_health, NULL, node, data_set);
890 if (data_set->
input == NULL) {
900 apply_system_health(data_set);
914 for (
GListPtr gIter = data_set->
nodes; gIter != NULL; gIter = gIter->next) {
923 pe_fence_node(data_set, node,
"the connection is unrecoverable", FALSE);
935 if (probed != NULL &&
crm_is_true(probed) == FALSE) {
943 for (
GListPtr gIter2 = data_set->
resources; gIter2 != NULL; gIter2 = gIter2->next) {
963 for (; gIter != NULL; gIter = gIter->next) {
965 rsc_discover_filter(child_rsc, node);
997 for (GList *item = rsc->
children; item != NULL;
1021 "Cancelling shutdown lock because %s is already active",
1029 }
else if (pcmk__list_of_1(rsc->
running_on)) {
1034 pe_rsc_debug(rsc,
"Not locking %s to unclean %s for shutdown",
1038 rsc->
lock_time = shutdown_time(node, data_set);
1051 pe_rsc_info(rsc,
"Locking %s to %s due to shutdown (expires @%lld)",
1053 (
long long) lock_expiration);
1056 pe_rsc_info(rsc,
"Locking %s to %s due to shutdown",
1061 for (GList *item = data_set->
nodes; item != NULL; item = item->next) {
1084 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
1085 apply_shutdown_lock((
pe_resource_t *) gIter->data, data_set);
1091 for (gIter = data_set->
nodes; gIter != NULL; gIter = gIter->next) {
1101 apply_placement_constraints(data_set);
1103 gIter = data_set->
nodes;
1104 for (; gIter != NULL; gIter = gIter->next) {
1109 for (; gIter2 != NULL; gIter2 = gIter2->next) {
1112 common_apply_stickiness(rsc, node, data_set);
1113 rsc_discover_filter(rsc, node);
1129 for (; gIter != NULL; gIter = gIter->next) {
1144 check_actions(data_set);
1149 convert_const_pointer(
const void *ptr)
1156 sort_rsc_process_order(gconstpointer a, gconstpointer b, gpointer
data)
1162 const char *reason =
"existence";
1171 GHashTable *r1_nodes = NULL;
1172 GHashTable *r2_nodes = NULL;
1174 reason =
"priority";
1178 if (r1_weight > r2_weight) {
1183 if (r1_weight < r2_weight) {
1188 reason =
"no node list";
1189 if (nodes == NULL) {
1194 resource1->
id, NULL, NULL, 1,
1199 resource2->
id, NULL, NULL, 1,
1204 reason =
"current location";
1209 r1_node = pe__current_node(resource1);
1210 r1_node = g_hash_table_lookup(r1_nodes, r1_node->
details->
id);
1211 if (r1_node != NULL) {
1212 r1_weight = r1_node->
weight;
1216 r2_node = pe__current_node(resource2);
1217 r2_node = g_hash_table_lookup(r2_nodes, r2_node->
details->
id);
1218 if (r2_node != NULL) {
1219 r2_weight = r2_node->
weight;
1223 if (r1_weight > r2_weight) {
1228 if (r1_weight < r2_weight) {
1234 for (gIter = nodes; gIter != NULL; gIter = gIter->next) {
1242 r1_node = g_hash_table_lookup(r1_nodes, node->
details->
id);
1245 r1_weight = r1_node->
weight;
1250 r2_node = g_hash_table_lookup(r2_nodes, node->
details->
id);
1253 r2_weight = r2_node->
weight;
1256 if (r1_weight > r2_weight) {
1261 if (r1_weight < r2_weight) {
1268 crm_trace(
"%s (%d) on %s %c %s (%d) on %s: %s",
1269 resource1->
id, r1_weight, r1_node ? r1_node->
details->
id :
"n/a",
1270 rc < 0 ? '>
' : rc > 0 ? '<
' : '=
', 1271 resource2->id, r2_weight, r2_node ? r2_node->details->id : "n/a", reason); 1274 g_hash_table_destroy(r1_nodes); 1277 g_hash_table_destroy(r2_nodes); 1284 allocate_resources(pe_working_set_t * data_set) 1286 GListPtr gIter = NULL; 1288 if (pcmk_is_set(data_set->flags, pe_flag_have_remote_nodes)) { 1289 /* Allocate remote connection resources first (which will also allocate 1290 * any colocation dependencies). If the connection is migrating, always 1291 * prefer the partial migration target. 1293 for (gIter = data_set->resources; gIter != NULL; gIter = gIter->next) { 1294 pe_resource_t *rsc = (pe_resource_t *) gIter->data; 1295 if (rsc->is_remote_node == FALSE) { 1298 pe_rsc_trace(rsc, "Allocating remote connection resource '%s
'", 1300 rsc->cmds->allocate(rsc, rsc->partial_migration_target, data_set); 1304 /* now do the rest of the resources */ 1305 for (gIter = data_set->resources; gIter != NULL; gIter = gIter->next) { 1306 pe_resource_t *rsc = (pe_resource_t *) gIter->data; 1307 if (rsc->is_remote_node == TRUE) { 1310 pe_rsc_trace(rsc, "Allocating %s resource '%s
'", 1311 crm_element_name(rsc->xml), rsc->id); 1312 rsc->cmds->allocate(rsc, NULL, data_set); 1316 /* We always use pe_order_preserve with these convenience functions to exempt 1317 * internally generated constraints from the prohibition of user constraints 1318 * involving remote connection resources. 1320 * The start ordering additionally uses pe_order_runnable_left so that the 1321 * specified action is not runnable if the start is not runnable. 1325 order_start_then_action(pe_resource_t *lh_rsc, pe_action_t *rh_action, 1326 enum pe_ordering extra, pe_working_set_t *data_set) 1328 if (lh_rsc && rh_action && data_set) { 1329 custom_action_order(lh_rsc, start_key(lh_rsc), NULL, 1330 rh_action->rsc, NULL, rh_action, 1331 pe_order_preserve | pe_order_runnable_left | extra, 1337 order_action_then_stop(pe_action_t *lh_action, pe_resource_t *rh_rsc, 1338 enum pe_ordering extra, pe_working_set_t *data_set) 1340 if (lh_action && rh_rsc && data_set) { 1341 custom_action_order(lh_action->rsc, NULL, lh_action, 1342 rh_rsc, stop_key(rh_rsc), NULL, 1343 pe_order_preserve | extra, data_set); 1347 // Clear fail counts for orphaned rsc on all online nodes 1349 cleanup_orphans(pe_resource_t * rsc, pe_working_set_t * data_set) 1351 GListPtr gIter = NULL; 1353 for (gIter = data_set->nodes; gIter != NULL; gIter = gIter->next) { 1354 pe_node_t *node = (pe_node_t *) gIter->data; 1356 if (node->details->online 1357 && pe_get_failcount(node, rsc, NULL, pe_fc_effective, NULL, 1360 pe_action_t *clear_op = NULL; 1362 clear_op = pe__clear_failcount(rsc, node, "it is orphaned", 1365 /* We can't use order_action_then_stop() here because its
1386 g_list_sort_with_data(data_set->
resources, sort_rsc_process_order, nodes);
1391 gIter = data_set->
nodes;
1392 for (; gIter != NULL; gIter = gIter->next) {
1401 allocate_resources(data_set);
1403 gIter = data_set->
nodes;
1404 for (; gIter != NULL; gIter = gIter->next) {
1455 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
1462 cleanup_orphans(rsc, data_set);
1469 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
1488 for (; gIter != NULL; gIter = gIter->next) {
1491 if (is_managed(child_rsc)) {
1505 for (; gIter != NULL; gIter = gIter->next) {
1508 if (is_managed(rsc)) {
1535 const char *fence_action =
"off";
1544 fence_action =
"reboot";
1551 stonith_op =
pe_fence_op(node, fence_action, FALSE,
"guest is unclean", FALSE, data_set);
1553 __func__, __LINE__);
1561 crm_info(
"Implying guest node %s is down (action %d) after %s fencing",
1569 crm_info(
"Implying guest node %s is down (action %d) " 1570 "after container %s is stopped (action %d)",
1572 container->
id, stop->
id);
1586 crm_info(
"Implying guest node %s is down (action %d) " 1587 "after connection is stopped (action %d)",
1593 crm_info(
"Implying guest node %s is down (action %d) ",
1610 gboolean integrity_lost = FALSE;
1611 gboolean need_stonith = TRUE;
1614 GList *shutdown_ops = NULL;
1622 crm_trace(
"Creating remote ordering constraints");
1623 apply_remote_node_ordering(data_set);
1625 crm_trace(
"Processing fencing and shutdown cases");
1626 if (any_managed_resources(data_set) == FALSE) {
1627 crm_notice(
"Delaying fencing operations until there are resources to manage");
1628 need_stonith = FALSE;
1632 for (gIter = data_set->
nodes; gIter != NULL; gIter = gIter->next) {
1641 fence_guest(node, data_set);
1651 stonith_op =
pe_fence_op(node, NULL, FALSE,
"node is unclean", FALSE, data_set);
1658 dc_down = stonith_op;
1663 && (stonith_ops != NULL)) {
1674 stonith_ops = g_list_prepend(stonith_ops, stonith_op);
1690 shutdown_ops = g_list_prepend(shutdown_ops, down_op);
1695 integrity_lost = TRUE;
1700 if (integrity_lost) {
1702 pe_warn(
"YOUR RESOURCES ARE NOW LIKELY COMPROMISED");
1703 pe_err(
"ENABLE STONITH TO KEEP YOUR RESOURCES SAFE");
1706 crm_notice(
"Cannot fence unclean nodes until quorum is" 1707 " attained (or no-quorum-policy is set to ignore)");
1711 if (dc_down != NULL) {
1720 for (gIter = shutdown_ops; gIter != NULL; gIter = gIter->next) {
1723 crm_debug(
"Ordering shutdown on %s before %s on DC %s",
1737 for (gIter = stonith_ops; gIter != NULL; gIter = gIter->next) {
1741 }
else if (stonith_ops) {
1751 g_list_free(stonith_ops);
1752 g_list_free(shutdown_ops);
1773 guint interval_ms = 0;
1775 if (
parse_op_key(original_key, NULL, &task, &interval_ms)) {
1780 crm_err(
"search key: %s", original_key);
1804 crm_trace(
"Processing RH of ordering constraint %d", order->
id);
1806 if (rh_action != NULL) {
1807 rh_actions = g_list_prepend(NULL, rh_action);
1809 }
else if (rsc != NULL) {
1813 if (rh_actions == NULL) {
1814 pe_rsc_trace(rsc,
"No RH-Side (%s/%s) found for constraint..." 1822 if ((lh_action != NULL) && (lh_action->
rsc == rsc)
1831 for (; gIter != NULL; gIter = gIter->next) {
1839 __func__, __LINE__);
1846 g_list_free(rh_actions);
1858 crm_trace(
"Processing LH of ordering constraint %d", order->
id);
1861 if (lh_action != NULL) {
1862 lh_actions = g_list_prepend(NULL, lh_action);
1868 if (lh_actions == NULL && lh_rsc != rh_rsc) {
1870 char *op_type = NULL;
1871 guint interval_ms = 0;
1878 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 - ignoring",
1887 pe_rsc_trace(lh_rsc,
"No LH-Side (%s/%s) found for constraint %d with %s - creating",
1889 lh_action =
custom_action(lh_rsc, key, op_type, NULL, TRUE, TRUE, data_set);
1890 lh_actions = g_list_prepend(NULL, lh_action);
1897 for (; gIter != NULL; gIter = gIter->next) {
1900 if (rh_rsc == NULL && order->
rh_action) {
1904 rsc_order_then(lh_action_iter, rh_rsc, order);
1911 g_list_free(lh_actions);
1927 return (interval_ms > 0);
1948 remote_rsc =
action->node->details->remote_rsc;
1958 crm_trace(
"Order %s action %s relative to %s%s for %s%s",
2009 if (is_recurring_action(
action)) {
2015 order_start_then_action(remote_rsc,
action,
2037 cluster_node = pe__current_node(remote_rsc);
2077 }
else if (cluster_node == NULL) {
2086 }
else if (pcmk__list_of_multiple(remote_rsc->
running_on)
2112 if (
action->rsc == NULL) {
2119 remote_rsc =
action->node->details->remote_rsc;
2122 crm_trace(
"Order %s action %s relative to %s%s (state: %s)",
2125 remote_rsc->
id, state2text(state));
2145 order_start_then_action(remote_rsc,
action, order_opts, data_set);
2150 order_action_then_stop(
action, remote_rsc,
2160 pe_fence_node(data_set,
action->node,
"resources are active and the connection is unrecoverable", FALSE);
2167 order_action_then_stop(
action, remote_rsc,
2191 if (is_recurring_action(
action)) {
2196 order_start_then_action(remote_rsc,
action,
2200 pe_node_t *cluster_node = pe__current_node(remote_rsc);
2208 pe_fence_node(data_set,
action->node,
"resources are in an unknown state and the connection is unrecoverable", FALSE);
2219 order_action_then_stop(
action, remote_rsc,
2238 for (
GListPtr gIter = data_set->
actions; gIter != NULL; gIter = gIter->next) {
2243 if (
action->rsc == NULL) {
2251 if (
action->rsc->is_remote_node &&
2267 if (
action->node == NULL) {
2285 remote =
action->node->details->remote_rsc;
2286 if (remote == NULL) {
2297 for (GList *item =
action->rsc->actions; item != NULL;
2298 item = item->next) {
2304 action->rsc, NULL, rsc_action,
2319 if (remote->container) {
2321 apply_container_ordering(
action, data_set);
2325 apply_remote_ordering(
action, data_set);
2341 const char *op = g_hash_table_lookup(rh_action->
meta,
"stonith_action");
2378 if (lh_rsc == NULL) {
2381 }
else if (rh_rsc && lh_rsc == rh_rsc) {
2385 if (lh_action == NULL && lh_action_task == NULL) {
2389 if (rh_action == NULL && rh_action_task == NULL) {
2400 }
else if (lh_action == NULL
2410 if (rh_rsc && lh_rsc->
container == rh_rsc) {
2414 }
else if (rh_action == NULL && rh_action_task
2437 order_type = order->
type;
2441 if (probes == NULL) {
2446 rh_actions = g_list_prepend(rh_actions, rh_action);
2448 }
else if (rh_rsc && rh_action_task) {
2452 if (rh_actions == NULL) {
2453 g_list_free(probes);
2457 crm_trace(
"Processing for LH probe based on ordering constraint %s -> %s" 2458 " (id=%d, type=%.6x)",
2459 lh_action ? lh_action->
uuid : lh_action_task,
2460 rh_action ? rh_action->
uuid : rh_action_task,
2463 for (pIter = probes; pIter != NULL; pIter = pIter->next) {
2467 for (rIter = rh_actions; rIter != NULL; rIter = rIter->next) {
2470 if (order_first_probe_unneeded(probe, rh_action_iter)) {
2477 g_list_free(rh_actions);
2478 g_list_free(probes);
2483 order_first_probe_then_restart_repromote(
pe_action_t * probe,
2488 bool interleave = FALSE;
2492 || probe->
rsc == NULL
2509 crm_trace(
"Processing based on %s %s -> %s %s",
2521 && probe->
rsc != after->
rsc) {
2533 for (gIter = then_actions; gIter != NULL; gIter = gIter->next) {
2543 g_list_free(then_actions);
2548 const char *interleave_s = g_hash_table_lookup(after->
rsc->
meta,
2564 for (gIter = after->
actions_after; gIter != NULL; gIter = gIter->next) {
2583 if (after->
rsc == NULL
2596 && interleave == TRUE
2597 && (compatible_rsc == NULL
2598 || compatible_rsc != after_wrapper->
action->
rsc)) {
2603 crm_trace(
"Proceeding through %s %s -> %s %s (type=0x%.6x)",
2608 after_wrapper->
type);
2610 order_first_probe_then_restart_repromote(probe, after_wrapper->
action, data_set);
2618 for (gIter = data_set->
actions; gIter != NULL; gIter = gIter->next) {
2633 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
2636 order_first_rsc_probes(child, data_set);
2645 for (gIter = probes; gIter != NULL; gIter= gIter->next) {
2649 for (aIter = probe->
actions_after; aIter != NULL; aIter = aIter->next) {
2652 order_first_probe_then_restart_repromote(probe, after_wrapper->
action, data_set);
2653 clear_actions_tracking_flag(data_set);
2657 g_list_free(probes);
2665 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
2668 order_first_rsc_probes(rsc, data_set);
2671 order_first_probes_imply_stops(data_set);
2680 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
2732 start = actions->data;
2733 g_list_free(actions);
2737 crm_err(
"No start action for %s", rsc->
id);
2743 for (actions = start->actions_before; actions != NULL; actions = actions->next) {
2750 if(first->required_runnable_before) {
2752 for (clone_actions = first->actions_before; clone_actions != NULL; clone_actions = clone_actions->next) {
2763 crm_trace(
"Not a start op %s for %s", first->uuid, start->uuid);
2766 if(first_rsc == NULL) {
2770 crm_trace(
"Same parent %s for %s", first_rsc->id, start->uuid);
2773 }
else if(FALSE && pe_rsc_is_clone(
uber_parent(first_rsc)) == FALSE) {
2774 crm_trace(
"Not a clone %s for %s", first_rsc->id, start->uuid);
2778 crm_err(
"Applying %s before %s %d", first->uuid, start->uuid,
uber_parent(first_rsc)->variant);
2780 for (pIter = probes; pIter != NULL; pIter = pIter->next) {
2783 crm_err(
"Ordering %s before %s", first->uuid, probe->
uuid);
2794 order_first_probes(data_set);
2795 order_then_probes(data_set);
2801 GList *gIter = NULL;
2803 crm_trace(
"Applying ordering constraints");
2817 crm_trace(
"Applying ordering constraint: %d", order->
id);
2821 rsc_order_first(rsc, order, data_set);
2828 rsc_order_then(order->
lh_action, rsc, order);
2836 for (gIter = data_set->
actions; gIter != NULL; gIter = gIter->next) {
2843 order_probes(data_set);
2846 for (gIter = data_set->
actions; gIter != NULL; gIter = gIter->next) {
2853 for (gIter = data_set->
actions; gIter != NULL; gIter = gIter->next) {
2857 for (GList *input_iter =
action->actions_before;
2858 input_iter != NULL; input_iter = input_iter->next) {
2868 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
2876 static int transition_id = -1;
2888 crm_err(
"Calculated transition %d (with errors), saving inputs in %s",
2889 transition_id, filename);
2892 crm_warn(
"Calculated transition %d (with warnings), saving inputs in %s",
2893 transition_id, filename);
2896 crm_notice(
"Calculated transition %d, saving inputs in %s",
2897 transition_id, filename);
2900 crm_notice(
"Configuration errors found during scheduler processing," 2901 " please run \"crm_verify -L\" to identify issues");
2912 const char *value = NULL;
2915 crm_trace(
"Creating transition graph %d.", transition_id);
2944 char *recheck_epoch = NULL;
2949 free(recheck_epoch);
2966 for (; gIter != NULL; gIter = gIter->next) {
2979 crm_trace(
"processing non-resource actions");
2982 for (; gIter != NULL; gIter = gIter->next) {
2987 &&
action->node->details->shutdown
2989 && !pcmk_any_flags_set(
action->flags,
2999 crm_crit(
"Cannot %s node '%s' because of %s:%s%s (%s)",
3000 action->node->details->unclean ?
"fence" :
"shut down",
3012 crm_trace(
"Created transition graph %d.", transition_id);
3022 for (gIter = data_set->
actions; gIter != NULL; gIter = gIter->next) {
3023 char *node_name = NULL;
3027 if (
action->rsc != NULL) {
3035 }
else if(
action->node) {
3041 task = strdup(
"Shutdown");
3043 const char *op = g_hash_table_lookup(
action->meta,
"stonith_action");
3049 }
else if(terminal &&
action->reason) {
3050 printf(
" * %s %s '%s'\n", task, node_name,
action->reason);
3051 }
else if(terminal) {
3052 printf(
" * %s %s\n", task, node_name);
3053 }
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)
#define pe__clear_action_flags_as(function, line, action, flags_to_clear)
void complex_set_cmds(pe_resource_t *rsc)
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)
gboolean stage7(pe_working_set_t *data_set)
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
bool pe__is_guest_or_remote_node(const pe_node_t *node)
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...)
#define pe__set_action_flags(action, flags_to_set)
#define XML_ATTR_TRANSITION_MAGIC
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 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
bool pcmk__strcase_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
pe_node_t * partial_migration_source
gboolean stage3(pe_working_set_t *data_set)
#define pe_flag_concurrent_fencing
void pe__update_recheck_time(time_t recheck, pe_working_set_t *data_set)
#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)
gboolean stage4(pe_working_set_t *data_set)
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
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_object_functions_t * fns
#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
gboolean stage2(pe_working_set_t *data_set)
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)
gboolean stage5(pe_working_set_t *data_set)
const char * pe_pref(GHashTable *options, const char *name)
void(* internal_constraints)(pe_resource_t *, pe_working_set_t *)
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)
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
bool pcmk__ends_with(const char *s, const char *match)
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)
#define pe__set_resource_flags(resource, flags_to_set)
void trigger_unfencing(pe_resource_t *rsc, pe_node_t *node, const char *reason, pe_action_t *dependency, pe_working_set_t *data_set)
#define 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
bool pe__is_remote_node(const pe_node_t *node)
#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
#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)
gboolean(* create_probe)(pe_resource_t *, pe_node_t *, pe_action_t *, gboolean, pe_working_set_t *)
void clone_expand(pe_resource_t *rsc, pe_working_set_t *data_set)
int pcmk__guint_from_hash(GHashTable *table, const char *key, guint default_val, guint *result)
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...)
pe_resource_t * uber_parent(pe_resource_t *rsc)
#define pe_flag_sanitized
#define pe__clear_order_flags(order_flags, flags_to_clear)
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
bool pe__is_guest_node(const pe_node_t *node)
gboolean stage0(pe_working_set_t *data_set)
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
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)
#define pe__clear_action_flags(action, flags_to_clear)
int custom_action_order(pe_resource_t *lh_rsc, char *lh_task, pe_action_t *lh_action, pe_resource_t *rh_rsc, char *rh_task, pe_action_t *rh_action, enum pe_ordering type, pe_working_set_t *data_set)
#define crm_trace(fmt, args...)
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)
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
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)
void(* expand)(pe_resource_t *, pe_working_set_t *)
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)
xmlNode * create_xml_node(xmlNode *parent, const char *name)
void pcmk__log_transition_summary(const char *filename)
#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
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)
const char * placement_strategy
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)
enum rsc_role_e(* state)(const pe_resource_t *, gboolean)
gboolean show_utilization
void dump_node_capacity(int level, const char *comment, pe_node_t *node)
gboolean probe_resources(pe_working_set_t *data_set)
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)
long long crm_parse_ll(const char *text, const char *default_text)
Parse a long long integer value from a string.
void LogNodeActions(pe_working_set_t *data_set, gboolean terminal)
Cluster status and scheduling.
void add_hash_param(GHashTable *hash, const char *name, const char *value)
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...)
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)
void(* rsc_location)(pe_resource_t *, pe__location_t *)
#define XML_LRM_ATTR_INTERVAL_MS
#define crm_log_xml_info(xml, text)
gboolean stage8(pe_working_set_t *data_set)
void clone_create_actions(pe_resource_t *rsc, pe_working_set_t *data_set)
#define XML_LRM_ATTR_CALLID
#define CRMD_ACTION_MIGRATE
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)
void(* create_actions)(pe_resource_t *, pe_working_set_t *)
enum pe_action_flags flags
#define pe_rsc_maintenance
#define pe_rsc_failure_ignored
#define XML_CIB_TAG_STATUS
gboolean update_action_flags(pe_action_t *action, enum pe_action_flags flags, const char *source, int line)
bool pe__resource_is_remote_conn(const pe_resource_t *rsc, const pe_working_set_t *data_set)
#define crm_log_xml_trace(xml, text)
gboolean crm_is_true(const char *s)
bool pcmk__starts_with(const char *str, const char *prefix)
Check whether a string starts with a certain sequence.
CRM_TRACE_INIT_DATA(pacemaker)
#define XML_LRM_TAG_RSC_OP
#define pe_rsc_trace(rsc, fmt, args...)
#define pe__set_order_flags(order_flags, flags_to_set)
pe_action_t * find_first_action(GListPtr input, const char *uuid, const char *task, pe_node_t *on_node)
gboolean was_processing_error
#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 stage6(pe_working_set_t *data_set)
resource_alloc_functions_t resource_class_alloc_functions[]
gboolean was_processing_warning
void clone_internal_constraints(pe_resource_t *rsc, pe_working_set_t *data_set)
char * crm_strdup_printf(char const *format,...) __attribute__((__format__(__printf__
#define pe__clear_raw_action_flags(action_flags, action_name, flags_to_clear)
#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
#define pe__set_action_flags_as(function, line, action, flags_to_set)