12 #include <sys/param.h>
124 static unsigned long calls = 0;
125 gboolean changed = FALSE;
135 if (last != action->
flags) {
141 crm_trace(
"%s on %s: %sset flags 0x%.6x (was 0x%.6x, now 0x%.6x, %lu, %s)",
143 clear ?
"un-" :
"", flags, last, action->
flags, calls, source);
154 gboolean force_restart = FALSE;
155 gboolean delete_resource = FALSE;
156 gboolean changed = FALSE;
158 const char *value = NULL;
159 const char *old_value = NULL;
161 const char *attr_list[] = {
167 for (; attr_lpc <
PCMK__NELEM(attr_list); attr_lpc++) {
170 if (value == old_value
178 force_restart = TRUE;
179 crm_notice(
"Forcing restart of %s on %s, %s changed: %s -> %s",
188 delete_resource = TRUE;
190 }
else if (changed) {
191 delete_resource = TRUE;
193 return delete_resource;
200 guint interval_ms = 0;
203 const char *task = NULL;
204 const char *call_id = NULL;
214 rsc->
id, task, interval_ms,
215 active_node->
details->
uname, (reason? reason :
"unknown"));
217 cancel =
pe_cancel_op(rsc, task, interval_ms, active_node, data_set);
227 guint interval_ms = 0;
229 gboolean did_change = FALSE;
232 const char *digest_secure = NULL;
234 CRM_CHECK(active_node != NULL,
return FALSE);
237 if (interval_ms > 0) {
238 xmlNode *op_match = NULL;
246 if ((op_match == NULL)
248 CancelXmlOp(rsc, xml_op, active_node,
"orphan", data_set);
252 }
else if (op_match == NULL) {
287 out->
info(out,
"Only 'private' parameters to "
300 required =
custom_action(rsc, key, task, NULL, TRUE, TRUE, data_set);
304 trigger_unfencing(rsc, active_node,
"Device parameters changed", NULL, data_set);
311 trigger_unfencing(rsc, active_node,
"Device parameters changed (reload)", NULL, data_set);
315 if (interval_ms > 0) {
323 op =
custom_action(rsc, key, task, active_node, TRUE, TRUE, data_set);
327 }
else if (digest_restart) {
328 pe_rsc_trace(rsc,
"Reloading '%s' action for resource %s", task, rsc->
id);
336 pe_rsc_trace(rsc,
"Resource %s doesn't support agent reloads",
342 required =
custom_action(rsc, key, task, NULL, TRUE, TRUE, data_set);
361 const char *reason = NULL;
366 if (check_action_definition(rsc, node, rsc_op, data_set)
370 reason =
"action definition changed";
376 switch (digest_data->
rc) {
378 crm_trace(
"Resource %s history entry %s on %s has no digest to compare",
384 reason =
"resource parameters have changed";
403 const char *task = NULL;
405 xmlNode *rsc_op = NULL;
406 GList *op_list = NULL;
407 GList *sorted_op_list = NULL;
414 || pe_rsc_is_clone(parent) == FALSE
416 pe_rsc_trace(rsc,
"Skipping param check for %s and deleting: orphan", rsc->
id);
419 pe_rsc_trace(rsc,
"Skipping param check for %s (orphan clone)", rsc->
id);
424 if (check_rsc_parameters(rsc, node, rsc_entry, FALSE, data_set)) {
427 pe_rsc_trace(rsc,
"Skipping param check for %s: no longer active on %s",
434 if (check_rsc_parameters(rsc, node, rsc_entry, TRUE, data_set)) {
438 for (rsc_op = pcmk__xe_first_child(rsc_entry); rsc_op != NULL;
439 rsc_op = pcmk__xe_next(rsc_op)) {
442 op_list = g_list_prepend(op_list, rsc_op);
449 for (gIter = sorted_op_list; gIter != NULL; gIter = gIter->next) {
450 xmlNode *rsc_op = (xmlNode *) gIter->data;
451 guint interval_ms = 0;
455 if (start_index < stop_index) {
458 }
else if (offset < start_index) {
466 if ((interval_ms > 0) &&
469 CancelXmlOp(rsc, rsc_op, node,
"maintenance mode", data_set);
488 }
else if (check_action_definition(rsc, node, rsc_op, data_set)
496 g_list_free(sorted_op_list);
500 find_rsc_list(GList *result,
pe_resource_t * rsc,
const char *
id, gboolean renamed_clones,
504 gboolean match = FALSE;
511 if (data_set == NULL) {
514 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
517 result = find_rsc_list(result, child,
id, renamed_clones, partial,
524 if (strstr(rsc->
id,
id)) {
532 if (strcmp(rsc->
id,
id) == 0) {
541 result = g_list_prepend(result, rsc);
546 for (; gIter != NULL; gIter = gIter->next) {
549 result = find_rsc_list(result, child,
id, renamed_clones, partial, NULL);
559 const char *
id = NULL;
561 xmlNode *lrm_rscs = NULL;
564 xmlNode *node_state = NULL;
566 for (node_state = pcmk__xe_first_child(status); node_state != NULL;
567 node_state = pcmk__xe_next(node_state)) {
582 crm_trace(
"Skipping param check for %s: can't run resources",
590 xmlNode *rsc_entry = NULL;
592 for (rsc_entry = pcmk__xe_first_child(lrm_rscs);
594 rsc_entry = pcmk__xe_next(rsc_entry)) {
600 GList *result = NULL;
601 const char *rsc_id =
ID(rsc_entry);
605 result = find_rsc_list(NULL, NULL, rsc_id, TRUE, FALSE, data_set);
606 for (gIter = result; gIter != NULL; gIter = gIter->next) {
612 check_actions_for(rsc_entry, rsc, node, data_set);
627 gIter != NULL; gIter = gIter->next) {
659 int fail_count, countdown;
676 if (fail_count <= 0) {
689 if (countdown == 0) {
691 crm_warn(
"Forcing %s away from %s after %d failures (max=%d)",
695 crm_info(
"%s can fail %d more times on %s before being forced off",
706 for (; gIter != NULL; gIter = gIter->next) {
709 common_apply_stickiness(child_rsc, node, data_set);
719 if (current == NULL) {
721 }
else if ((match != NULL)
726 pe_rsc_debug(sticky_rsc,
"Resource %s: preferring current location"
727 " (node=%s, weight=%d)", sticky_rsc->
id,
733 pe_rsc_debug(rsc,
"Ignoring stickiness for %s: the cluster is asymmetric"
734 " and node %s is not explicitly allowed", rsc->
id, node->
details->
uname);
736 while (g_hash_table_iter_next(&iter, NULL, (
void **)&nIter)) {
753 if (failcount_clear_action_exists(node, rsc) == FALSE) {
754 check_migration_threshold(rsc, node, data_set);
763 rsc->
cmds = &resource_class_alloc_functions[rsc->
variant];
765 for (; gIter != NULL; gIter = gIter->next) {
778 for (; gIter != NULL; gIter = gIter->next) {
786 calculate_system_health(gpointer gKey, gpointer gValue, gpointer user_data)
788 const char *key = (
const char *)gKey;
789 const char *value = (
const char *)gValue;
790 int *system_health = (
int *)user_data;
792 if (!gKey || !gValue || !user_data) {
821 }
else if (pcmk__str_eq(health_strategy,
"migrate-on-red",
pcmk__str_casei)) {
830 }
else if (pcmk__str_eq(health_strategy,
"only-green",
pcmk__str_casei)) {
839 }
else if (pcmk__str_eq(health_strategy,
"progressive",
pcmk__str_casei)) {
845 "node-health-base"));
856 crm_err(
"Unknown node health strategy: %s", health_strategy);
860 crm_info(
"Applying automated node health strategy: %s", health_strategy);
862 for (gIter = data_set->
nodes; gIter != NULL; gIter = gIter->next) {
863 int system_health = base_health;
867 g_hash_table_foreach(node->
details->
attrs, calculate_system_health, &system_health);
869 crm_info(
" Node %s has an combined system health of %d",
875 if (system_health != 0) {
879 for (; gIter2 != NULL; gIter2 = gIter2->next) {
882 rsc2node_new(health_strategy, rsc, system_health, NULL, node, data_set);
895 if (data_set->
input == NULL) {
905 apply_system_health(data_set);
919 for (GList *gIter = data_set->
nodes; gIter != NULL; gIter = gIter->next) {
928 pe_fence_node(data_set, node,
"the connection is unrecoverable", FALSE);
940 if (probed != NULL &&
crm_is_true(probed) == FALSE) {
948 for (GList *gIter2 = data_set->
resources; gIter2 != NULL; gIter2 = gIter2->next) {
968 for (; gIter != NULL; gIter = gIter->next) {
970 rsc_discover_filter(child_rsc, node);
989 result = (time_t) result_ll;
1002 for (GList *item = rsc->
children; item != NULL;
1003 item = item->next) {
1004 apply_shutdown_lock((
pe_resource_t *) item->data, data_set);
1026 "Cancelling shutdown lock because %s is already active",
1034 }
else if (pcmk__list_of_1(rsc->
running_on)) {
1039 pe_rsc_debug(rsc,
"Not locking %s to unclean %s for shutdown",
1043 rsc->
lock_time = shutdown_time(node, data_set);
1056 pe_rsc_info(rsc,
"Locking %s to %s due to shutdown (expires @%lld)",
1058 (
long long) lock_expiration);
1061 pe_rsc_info(rsc,
"Locking %s to %s due to shutdown",
1066 for (GList *item = data_set->
nodes; item != NULL; item = item->next) {
1086 GList *gIter = NULL;
1089 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
1090 apply_shutdown_lock((
pe_resource_t *) gIter->data, data_set);
1096 for (gIter = data_set->
nodes; gIter != NULL; gIter = gIter->next) {
1106 apply_placement_constraints(data_set);
1108 gIter = data_set->
nodes;
1109 for (; gIter != NULL; gIter = gIter->next) {
1110 GList *gIter2 = NULL;
1114 for (; gIter2 != NULL; gIter2 = gIter2->next) {
1117 common_apply_stickiness(rsc, node, data_set);
1118 rsc_discover_filter(rsc, node);
1134 for (; gIter != NULL; gIter = gIter->next) {
1149 check_actions(data_set);
1154 convert_const_pointer(
const void *ptr)
1161 sort_rsc_process_order(gconstpointer a, gconstpointer b, gpointer
data)
1167 const char *reason =
"existence";
1169 GList *nodes = (GList *) data;
1175 GList *gIter = NULL;
1176 GHashTable *r1_nodes = NULL;
1177 GHashTable *r2_nodes = NULL;
1179 reason =
"priority";
1183 if (r1_weight > r2_weight) {
1188 if (r1_weight < r2_weight) {
1193 reason =
"no node list";
1194 if (nodes == NULL) {
1199 resource1->
id, NULL, NULL, 1,
1205 resource2->
id, NULL, NULL, 1,
1211 reason =
"current location";
1216 r1_node = pe__current_node(resource1);
1217 r1_node = g_hash_table_lookup(r1_nodes, r1_node->
details->
id);
1218 if (r1_node != NULL) {
1219 r1_weight = r1_node->
weight;
1223 r2_node = pe__current_node(resource2);
1224 r2_node = g_hash_table_lookup(r2_nodes, r2_node->
details->
id);
1225 if (r2_node != NULL) {
1226 r2_weight = r2_node->
weight;
1230 if (r1_weight > r2_weight) {
1235 if (r1_weight < r2_weight) {
1241 for (gIter = nodes; gIter != NULL; gIter = gIter->next) {
1249 r1_node = g_hash_table_lookup(r1_nodes, node->
details->
id);
1252 r1_weight = r1_node->
weight;
1257 r2_node = g_hash_table_lookup(r2_nodes, node->
details->
id);
1260 r2_weight = r2_node->
weight;
1263 if (r1_weight > r2_weight) {
1268 if (r1_weight < r2_weight) {
1275 crm_trace(
"%s (%d) on %s %c %s (%d) on %s: %s",
1276 resource1->
id, r1_weight, r1_node ? r1_node->
details->
id :
"n/a",
1277 rc < 0 ? '>
' : rc > 0 ? '<
' : '=
',
1278 resource2->id, r2_weight, r2_node ? r2_node->details->id : "n/a", reason);
1281 g_hash_table_destroy(r1_nodes);
1284 g_hash_table_destroy(r2_nodes);
1291 allocate_resources(pe_working_set_t * data_set)
1293 GList *gIter = NULL;
1295 if (pcmk_is_set(data_set->flags, pe_flag_have_remote_nodes)) {
1296 /* Allocate remote connection resources first (which will also allocate
1297 * any colocation dependencies). If the connection is migrating, always
1298 * prefer the partial migration target.
1300 for (gIter = data_set->resources; gIter != NULL; gIter = gIter->next) {
1301 pe_resource_t *rsc = (pe_resource_t *) gIter->data;
1302 if (rsc->is_remote_node == FALSE) {
1305 pe_rsc_trace(rsc, "Allocating remote connection resource '%s
'",
1307 rsc->cmds->allocate(rsc, rsc->partial_migration_target, data_set);
1311 /* now do the rest of the resources */
1312 for (gIter = data_set->resources; gIter != NULL; gIter = gIter->next) {
1313 pe_resource_t *rsc = (pe_resource_t *) gIter->data;
1314 if (rsc->is_remote_node == TRUE) {
1317 pe_rsc_trace(rsc, "Allocating %s resource '%s
'",
1318 crm_element_name(rsc->xml), rsc->id);
1319 rsc->cmds->allocate(rsc, NULL, data_set);
1323 /* We always use pe_order_preserve with these convenience functions to exempt
1324 * internally generated constraints from the prohibition of user constraints
1325 * involving remote connection resources.
1327 * The start ordering additionally uses pe_order_runnable_left so that the
1328 * specified action is not runnable if the start is not runnable.
1332 order_start_then_action(pe_resource_t *lh_rsc, pe_action_t *rh_action,
1333 enum pe_ordering extra, pe_working_set_t *data_set)
1335 if (lh_rsc && rh_action && data_set) {
1336 custom_action_order(lh_rsc, start_key(lh_rsc), NULL,
1337 rh_action->rsc, NULL, rh_action,
1338 pe_order_preserve | pe_order_runnable_left | extra,
1344 order_action_then_stop(pe_action_t *lh_action, pe_resource_t *rh_rsc,
1345 enum pe_ordering extra, pe_working_set_t *data_set)
1347 if (lh_action && rh_rsc && data_set) {
1348 custom_action_order(lh_action->rsc, NULL, lh_action,
1349 rh_rsc, stop_key(rh_rsc), NULL,
1350 pe_order_preserve | extra, data_set);
1354 // Clear fail counts for orphaned rsc on all online nodes
1356 cleanup_orphans(pe_resource_t * rsc, pe_working_set_t * data_set)
1358 GList *gIter = NULL;
1360 for (gIter = data_set->nodes; gIter != NULL; gIter = gIter->next) {
1361 pe_node_t *node = (pe_node_t *) gIter->data;
1363 if (node->details->online
1364 && pe_get_failcount(node, rsc, NULL, pe_fc_effective, NULL,
1367 pe_action_t *clear_op = NULL;
1369 clear_op = pe__clear_failcount(rsc, node, "it is orphaned",
1372 /* We can't use order_action_then_stop() here because its
1386 GList *gIter = NULL;
1389 GList *nodes = g_list_copy(data_set->
nodes);
1393 g_list_sort_with_data(data_set->
resources, sort_rsc_process_order, nodes);
1398 gIter = data_set->
nodes;
1399 for (; gIter != NULL; gIter = gIter->next) {
1403 out->
message(out,
"node-capacity", node,
"Original");
1410 allocate_resources(data_set);
1412 gIter = data_set->
nodes;
1413 for (; gIter != NULL; gIter = gIter->next) {
1417 out->
message(out,
"node-capacity", node,
"Remaining");
1466 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
1473 cleanup_orphans(rsc, data_set);
1480 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
1499 for (; gIter != NULL; gIter = gIter->next) {
1502 if (is_managed(child_rsc)) {
1516 for (; gIter != NULL; gIter = gIter->next) {
1519 if (is_managed(rsc)) {
1546 const char *fence_action =
"off";
1555 fence_action =
"reboot";
1562 stonith_op =
pe_fence_op(node, fence_action, FALSE,
"guest is unclean", FALSE, data_set);
1564 __func__, __LINE__);
1572 crm_info(
"Implying guest node %s is down (action %d) after %s fencing",
1580 crm_info(
"Implying guest node %s is down (action %d) "
1581 "after container %s is stopped (action %d)",
1583 container->
id, stop->
id);
1597 crm_info(
"Implying guest node %s is down (action %d) "
1598 "after connection is stopped (action %d)",
1604 crm_info(
"Implying guest node %s is down (action %d) ",
1621 gboolean integrity_lost = FALSE;
1622 gboolean need_stonith = TRUE;
1624 GList *stonith_ops = NULL;
1625 GList *shutdown_ops = NULL;
1633 crm_trace(
"Creating remote ordering constraints");
1634 apply_remote_node_ordering(data_set);
1636 crm_trace(
"Processing fencing and shutdown cases");
1637 if (any_managed_resources(data_set) == FALSE) {
1638 crm_notice(
"Delaying fencing operations until there are resources to manage");
1639 need_stonith = FALSE;
1643 for (gIter = data_set->
nodes; gIter != NULL; gIter = gIter->next) {
1652 fence_guest(node, data_set);
1662 stonith_op =
pe_fence_op(node, NULL, FALSE,
"node is unclean", FALSE, data_set);
1669 dc_down = stonith_op;
1674 && (stonith_ops != NULL)) {
1685 stonith_ops = g_list_prepend(stonith_ops, stonith_op);
1701 shutdown_ops = g_list_prepend(shutdown_ops, down_op);
1706 integrity_lost = TRUE;
1711 if (integrity_lost) {
1713 pe_warn(
"YOUR RESOURCES ARE NOW LIKELY COMPROMISED");
1714 pe_err(
"ENABLE STONITH TO KEEP YOUR RESOURCES SAFE");
1717 crm_notice(
"Cannot fence unclean nodes until quorum is"
1718 " attained (or no-quorum-policy is set to ignore)");
1722 if (dc_down != NULL) {
1731 for (gIter = shutdown_ops; gIter != NULL; gIter = gIter->next) {
1734 crm_debug(
"Ordering shutdown on %s before %s on DC %s",
1748 for (gIter = stonith_ops; gIter != NULL; gIter = gIter->next) {
1752 }
else if (stonith_ops) {
1762 g_list_free(stonith_ops);
1763 g_list_free(shutdown_ops);
1775 find_actions_by_task(GList *actions,
pe_resource_t * rsc,
const char *original_key)
1784 guint interval_ms = 0;
1786 if (
parse_op_key(original_key, NULL, &task, &interval_ms)) {
1791 crm_err(
"search key: %s", original_key);
1805 GList *gIter = NULL;
1806 GList *rh_actions = NULL;
1815 crm_trace(
"Processing RH of ordering constraint %d", order->
id);
1817 if (rh_action != NULL) {
1818 rh_actions = g_list_prepend(NULL, rh_action);
1820 }
else if (rsc != NULL) {
1824 if (rh_actions == NULL) {
1825 pe_rsc_trace(rsc,
"No RH-Side (%s/%s) found for constraint..."
1833 if ((lh_action != NULL) && (lh_action->
rsc == rsc)
1842 for (; gIter != NULL; gIter = gIter->next) {
1850 __func__, __LINE__);
1851 crm_warn(
"Unrunnable %s 0x%.6x", rh_action_iter->
uuid, type);
1853 crm_warn(
"neither %s 0x%.6x", rh_action_iter->
uuid, type);
1857 g_list_free(rh_actions);
1864 GList *gIter = NULL;
1865 GList *lh_actions = NULL;
1869 crm_trace(
"Processing LH of ordering constraint %d", order->
id);
1872 if (lh_action != NULL) {
1873 lh_actions = g_list_prepend(NULL, lh_action);
1879 if (lh_actions == NULL && lh_rsc != rh_rsc) {
1881 char *op_type = NULL;
1882 guint interval_ms = 0;
1889 pe_rsc_trace(lh_rsc,
"No LH-Side (%s/%s) found for constraint %d with %s - ignoring",
1895 pe_rsc_trace(lh_rsc,
"No LH-Side (%s/%s) found for constraint %d with %s - ignoring",
1899 pe_rsc_trace(lh_rsc,
"No LH-Side (%s/%s) found for constraint %d with %s - creating",
1901 lh_action =
custom_action(lh_rsc, key, op_type, NULL, TRUE, TRUE, data_set);
1902 lh_actions = g_list_prepend(NULL, lh_action);
1909 for (; gIter != NULL; gIter = gIter->next) {
1912 if (rh_rsc == NULL && order->
rh_action) {
1916 rsc_order_then(lh_action_iter, rh_rsc, order);
1923 g_list_free(lh_actions);
1939 return (interval_ms > 0);
1970 crm_trace(
"Order %s action %s relative to %s%s for %s%s",
2021 if (is_recurring_action(action)) {
2027 order_start_then_action(remote_rsc, action,
2049 cluster_node = pe__current_node(remote_rsc);
2089 }
else if (cluster_node == NULL) {
2098 }
else if (pcmk__list_of_multiple(remote_rsc->
running_on)
2124 if (action->
rsc == NULL) {
2134 crm_trace(
"Order %s action %s relative to %s%s (state: %s)",
2137 remote_rsc->
id, state2text(state));
2157 order_start_then_action(remote_rsc, action, order_opts, data_set);
2162 order_action_then_stop(action, remote_rsc,
2172 pe_fence_node(data_set, action->
node,
"resources are active and the connection is unrecoverable", FALSE);
2179 order_action_then_stop(action, remote_rsc,
2186 order_start_then_action(remote_rsc, action,
pe_order_none, data_set);
2203 if (is_recurring_action(action)) {
2208 order_start_then_action(remote_rsc, action,
2212 pe_node_t *cluster_node = pe__current_node(remote_rsc);
2220 pe_fence_node(data_set, action->
node,
"resources are in an unknown state and the connection is unrecoverable", FALSE);
2231 order_action_then_stop(action, remote_rsc,
2250 for (GList *gIter = data_set->
actions; gIter != NULL; gIter = gIter->next) {
2255 if (action->
rsc == NULL) {
2279 if (action->
node == NULL) {
2298 if (remote == NULL) {
2309 for (GList *item = action->
rsc->
actions; item != NULL;
2310 item = item->next) {
2316 action->
rsc, NULL, rsc_action,
2331 if (remote->container) {
2333 apply_container_ordering(action, data_set);
2337 apply_remote_ordering(action, data_set);
2353 const char *op = g_hash_table_lookup(rh_action->
meta,
"stonith_action");
2372 GList *gIter = NULL;
2385 GList *probes = NULL;
2386 GList *rh_actions = NULL;
2388 GList *pIter = NULL;
2390 if (lh_rsc == NULL) {
2393 }
else if (rh_rsc && lh_rsc == rh_rsc) {
2397 if (lh_action == NULL && lh_action_task == NULL) {
2401 if (rh_action == NULL && rh_action_task == NULL) {
2412 }
else if (lh_action == NULL
2422 if (rh_rsc && lh_rsc->
container == rh_rsc) {
2426 }
else if (rh_action == NULL && rh_action_task
2449 order_type = order->
type;
2453 if (probes == NULL) {
2458 rh_actions = g_list_prepend(rh_actions, rh_action);
2460 }
else if (rh_rsc && rh_action_task) {
2464 if (rh_actions == NULL) {
2465 g_list_free(probes);
2469 crm_trace(
"Processing for LH probe based on ordering constraint %s -> %s"
2470 " (id=%d, type=%.6x)",
2471 lh_action ? lh_action->
uuid : lh_action_task,
2472 rh_action ? rh_action->
uuid : rh_action_task,
2475 for (pIter = probes; pIter != NULL; pIter = pIter->next) {
2477 GList *rIter = NULL;
2479 for (rIter = rh_actions; rIter != NULL; rIter = rIter->next) {
2482 if (order_first_probe_unneeded(probe, rh_action_iter)) {
2489 g_list_free(rh_actions);
2490 g_list_free(probes);
2495 order_first_probe_then_restart_repromote(
pe_action_t * probe,
2499 GList *gIter = NULL;
2500 bool interleave = FALSE;
2504 || probe->
rsc == NULL
2521 crm_trace(
"Processing based on %s %s -> %s %s",
2533 && probe->
rsc != after->
rsc) {
2535 GList *then_actions = NULL;
2545 for (gIter = then_actions; gIter != NULL; gIter = gIter->next) {
2555 g_list_free(then_actions);
2560 const char *interleave_s = g_hash_table_lookup(after->
rsc->
meta,
2576 for (gIter = after->
actions_after; gIter != NULL; gIter = gIter->next) {
2595 if (after->
rsc == NULL
2608 && interleave == TRUE
2609 && (compatible_rsc == NULL
2610 || compatible_rsc != after_wrapper->
action->
rsc)) {
2615 crm_trace(
"Proceeding through %s %s -> %s %s (type=0x%.6x)",
2620 after_wrapper->
type);
2622 order_first_probe_then_restart_repromote(probe, after_wrapper->
action, data_set);
2628 GList *gIter = NULL;
2630 for (gIter = data_set->
actions; gIter != NULL; gIter = gIter->next) {
2642 GList *gIter = NULL;
2643 GList *probes = NULL;
2645 for (gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
2648 order_first_rsc_probes(child, data_set);
2657 for (gIter = probes; gIter != NULL; gIter= gIter->next) {
2659 GList *aIter = NULL;
2661 for (aIter = probe->
actions_after; aIter != NULL; aIter = aIter->next) {
2664 order_first_probe_then_restart_repromote(probe, after_wrapper->
action, data_set);
2665 clear_actions_tracking_flag(data_set);
2669 g_list_free(probes);
2675 GList *gIter = NULL;
2677 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
2680 order_first_rsc_probes(rsc, data_set);
2683 order_first_probes_imply_stops(data_set);
2690 GList *gIter = NULL;
2692 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
2738 GList *actions = NULL;
2739 GList *probes = NULL;
2744 start = actions->data;
2745 g_list_free(actions);
2749 crm_err(
"No start action for %s", rsc->
id);
2755 for (actions = start->actions_before; actions != NULL; actions = actions->next) {
2758 GList *pIter = NULL;
2762 if(first->required_runnable_before) {
2763 GList *clone_actions = NULL;
2764 for (clone_actions = first->actions_before; clone_actions != NULL; clone_actions = clone_actions->next) {
2775 crm_trace(
"Not a start op %s for %s", first->uuid, start->uuid);
2778 if(first_rsc == NULL) {
2782 crm_trace(
"Same parent %s for %s", first_rsc->id, start->uuid);
2785 }
else if(FALSE && pe_rsc_is_clone(
uber_parent(first_rsc)) == FALSE) {
2786 crm_trace(
"Not a clone %s for %s", first_rsc->id, start->uuid);
2790 crm_err(
"Applying %s before %s %d", first->uuid, start->uuid,
uber_parent(first_rsc)->variant);
2792 for (pIter = probes; pIter != NULL; pIter = pIter->next) {
2795 crm_err(
"Ordering %s before %s", first->uuid, probe->
uuid);
2806 order_first_probes(data_set);
2807 order_then_probes(data_set);
2815 GList *gIter = NULL;
2817 crm_trace(
"Applying ordering constraints");
2831 crm_trace(
"Applying ordering constraint: %d", order->
id);
2835 rsc_order_first(rsc, order, data_set);
2842 rsc_order_then(order->
lh_action, rsc, order);
2850 for (gIter = data_set->
actions; gIter != NULL; gIter = gIter->next) {
2857 order_probes(data_set);
2860 for (gIter = data_set->
actions; gIter != NULL; gIter = gIter->next) {
2867 for (gIter = data_set->
actions; gIter != NULL; gIter = gIter->next) {
2872 input_iter != NULL; input_iter = input_iter->next) {
2890 data_set->
priv = out;
2895 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
2905 data_set->
priv = prev_out;
2909 static int transition_id = -1;
2921 crm_err(
"Calculated transition %d (with errors)%s%s",
2923 (filename == NULL)?
"" :
", saving inputs in ",
2924 (filename == NULL)?
"" : filename);
2927 crm_warn(
"Calculated transition %d (with warnings)%s%s",
2929 (filename == NULL)?
"" :
", saving inputs in ",
2930 (filename == NULL)?
"" : filename);
2935 (filename == NULL)?
"" :
", saving inputs in ",
2936 (filename == NULL)?
"" : filename);
2939 crm_notice(
"Configuration errors found during scheduler processing,"
2940 " please run \"crm_verify -L\" to identify issues");
2950 GList *gIter = NULL;
2951 const char *value = NULL;
2952 long long limit = 0LL;
2955 crm_trace(
"Creating transition graph %d.", transition_id);
2984 char *recheck_epoch = NULL;
2989 free(recheck_epoch);
3006 for (; gIter != NULL; gIter = gIter->next) {
3019 crm_trace(
"processing non-resource actions");
3022 for (; gIter != NULL; gIter = gIter->next) {
3029 && !pcmk_any_flags_set(action->
flags,
3039 crm_crit(
"Cannot %s node '%s' because of %s:%s%s (%s)",
3052 crm_trace(
"Created transition graph %d.", transition_id);
3061 GList *gIter = NULL;
3063 for (gIter = data_set->
actions; gIter != NULL; gIter = gIter->next) {
3064 char *node_name = NULL;
3068 if (action->
rsc != NULL) {
3076 }
else if(action->
node) {
3082 task = strdup(
"Shutdown");
3084 const char *op = g_hash_table_lookup(action->
meta,
"stonith_action");
3088 out->
message(out,
"node-action", task, node_name, 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)
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
bool pe__is_guest_or_remote_node(const pe_node_t *node)
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...)
#define pe__set_action_flags(action, flags_to_set)
gboolean stage2(pe_working_set_t *data_set)
gboolean stage5(pe_working_set_t *data_set)
#define pe__show_node_weights(level, rsc, text, nodes, 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
bool pcmk__strcase_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
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__output_set_log_level(pcmk__output_t *out, int log_level)
void pcmk__log_transition_summary(const char *filename)
#define XML_CIB_TAG_CONSTRAINTS
resource_alloc_functions_t * cmds
#define pe_flag_symmetric_cluster
void native_rsc_colocation_lh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
bool pcmk__ordering_is_invalid(pe_action_t *action, pe_action_wrapper_t *input)
GList * find_actions(GList *input, const char *key, const pe_node_t *on_node)
xmlNode * get_object_root(const char *object_type, xmlNode *the_root)
#define pe_flag_no_compat
gboolean stage0(pe_working_set_t *data_set)
enum rsc_role_e next_role
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
#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)
bool pe__bundle_needs_remote_name(pe_resource_t *rsc, pe_working_set_t *data_set)
int(* message)(pcmk__output_t *out, const char *message_id,...)
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)
enum crm_ais_msg_types type
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
void pcmk__bundle_rsc_colocation_lh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
#define CRM_SCORE_INFINITY
gboolean remote_requires_reset
#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 CRM_TRACE_INIT_DATA(name)
#define CRMD_ACTION_START
bool pe__is_remote_node(const pe_node_t *node)
#define XML_LRM_ATTR_TASK
void clone_rsc_colocation_lh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
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)
void group_rsc_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
#define CRM_OP_CLEAR_FAILCOUNT
gboolean crm_config_error
int pcmk__scan_ll(const char *text, long long *result, long long default_value)
#define pe_flag_have_remote_nodes
#define crm_warn(fmt, args...)
void(* end_list)(pcmk__output_t *out)
guint remote_reconnect_ms
void native_create_actions(pe_resource_t *rsc, pe_working_set_t *data_set)
void(* create_actions)(pe_resource_t *, pe_working_set_t *)
void clone_expand(pe_resource_t *rsc, pe_working_set_t *data_set)
void native_rsc_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, pcmk__colocation_t *constraint, 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...)
gboolean stage8(pe_working_set_t *data_set)
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
void(* begin_list)(pcmk__output_t *out, const char *singular_noun, const char *plural_noun, const char *format,...) G_GNUC_PRINTF(4
pcmk__output_t * pcmk__new_logger(void)
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
void clone_rsc_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
#define XML_CIB_TAG_STATE
bool pe__is_guest_node(const pe_node_t *node)
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)
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)
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
int(* info)(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
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 LogActions(pe_resource_t *rsc, pe_working_set_t *data_set)
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)
void pcmk__bundle_rsc_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
const char * placement_strategy
void LogNodeActions(pe_working_set_t *data_set)
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)
void pcmk__output_free(pcmk__output_t *out)
pe_node_t * pe_find_node_id(GList *node_list, const char *id)
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 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)
Cluster status and scheduling.
GList * ordering_constraints
void add_hash_param(GHashTable *hash, const char *name, const char *value)
#define pe_flag_show_utilization
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)
#define XML_LRM_TAG_RESOURCES
int pe__add_scores(int score1, int score2)
#define crm_err(fmt, args...)
void(* finish)(pcmk__output_t *out, crm_exit_t exit_status, bool print, void **copy_dest)
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)
This structure contains everything that makes up a single output formatter.
#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
GList * placement_constraints
pe_working_set_t * cluster
#define XML_CIB_TAG_STATUS
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.
#define XML_LRM_TAG_RSC_OP
#define pe_rsc_trace(rsc, fmt, args...)
#define pe__set_order_flags(order_flags, flags_to_set)
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 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)
#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)
pe_action_t * find_first_action(GList *input, const char *uuid, const char *task, pe_node_t *on_node)
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)
void group_rsc_colocation_lh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
#define pe_flag_shutdown_lock
#define pe_rsc_info(rsc, fmt, args...)
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)