31 struct action_history {
40 const char *exit_reason;
43 int expected_exit_status;
52 #define set_config_flag(data_set, option, flag) do { \ 53 const char *scf_value = pe_pref((data_set)->config_hash, (option)); \ 54 if (scf_value != NULL) { \ 55 if (crm_is_true(scf_value)) { \ 56 (data_set)->flags = pcmk__set_flags_as(__func__, __LINE__, \ 57 LOG_TRACE, "Working set", \ 58 crm_system_name, (data_set)->flags, \ 61 (data_set)->flags = pcmk__clear_flags_as(__func__, __LINE__,\ 62 LOG_TRACE, "Working set", \ 63 crm_system_name, (data_set)->flags, \ 70 xmlNode **last_failure,
74 static void add_node_attrs(
const xmlNode *xml_obj,
pe_node_t *node,
76 static void determine_online_status(
const xmlNode *node_state,
80 static void unpack_node_lrm(
pe_node_t *node,
const xmlNode *xml,
114 const char *reason,
bool priority_delay)
125 "(otherwise would because %s): " 126 "its guest resource %s is unmanaged",
127 pe__node_name(node), reason, rsc->
id);
129 crm_warn(
"Guest node %s will be fenced " 130 "(by recovering its guest resource %s): %s",
131 pe__node_name(node), rsc->
id, reason);
142 }
else if (is_dangling_guest_node(node)) {
143 crm_info(
"Cleaning up dangling connection for guest node %s: " 144 "fencing was already done because %s, " 145 "and guest resource no longer exists",
146 pe__node_name(node), reason);
155 "(otherwise would because %s): connection is unmanaged",
156 pe__node_name(node), reason);
169 crm_trace(
"Cluster node %s %s because %s",
187 #define XPATH_UNFENCING_NVPAIR XML_CIB_TAG_NVPAIR \ 188 "[(@" XML_NVPAIR_ATTR_NAME "='" PCMK_STONITH_PROVIDES "'" \ 189 "or @" XML_NVPAIR_ATTR_NAME "='" XML_RSC_ATTR_REQUIRES "') " \ 190 "and @" XML_NVPAIR_ATTR_VALUE "='" PCMK__VALUE_UNFENCING "']" 193 #define XPATH_ENABLE_UNFENCING \ 194 "/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION "/" XML_CIB_TAG_RESOURCES \ 195 "//" XML_TAG_META_SETS "/" XPATH_UNFENCING_NVPAIR \ 196 "|/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION "/" XML_CIB_TAG_RSCCONFIG \ 197 "/" XML_TAG_META_SETS "/" XPATH_UNFENCING_NVPAIR 202 xmlXPathObjectPtr
result = NULL;
216 const char *value = NULL;
237 crm_info(
"Startup probes: disabled (dangerous)");
242 crm_info(
"Watchdog-based self-fencing will be performed via SBD if " 243 "fencing is required and stonith-watchdog-timeout is nonzero");
257 crm_debug(
"STONITH of failed nodes is %s",
263 "Support for stonith-action of 'poweroff' is deprecated " 264 "and will be removed in a future release (use 'off' instead)");
281 crm_debug(
"Stop all active resources: %s",
286 crm_debug(
"Cluster is symmetric" " - resources can run anywhere by default");
309 crm_notice(
"Resetting no-quorum-policy to 'stop': cluster has never had quorum");
314 "fencing is disabled");
324 crm_debug(
"On loss of quorum: Freeze resources");
327 crm_debug(
"On loss of quorum: Stop ALL resources");
331 "Demote promotable resources and stop other resources");
334 crm_notice(
"On loss of quorum: Fence all remaining nodes");
346 crm_trace(
"Orphan resource actions are %s",
353 #ifndef PCMK__COMPAT_2_0 355 "Support for the remove-after-stop cluster property is" 356 " deprecated and will be removed in a future release");
375 crm_trace(
"Unseen nodes will be fenced");
386 crm_trace(
"Resources will%s be locked to cleanly shut down nodes",
409 if (new_node == NULL) {
416 if (new_node->
details == NULL) {
443 "assuming 'ping'", pcmk__s(
uname,
"without name"),
447 "Support for nodes of type 'ping' (such as %s) is " 448 "deprecated and will be removed in a future release",
449 pcmk__s(
uname,
"unnamed node"));
475 xmlNode *attr_set = NULL;
476 xmlNode *attr = NULL;
478 const char *container_id =
ID(xml_obj);
479 const char *remote_name = NULL;
480 const char *remote_server = NULL;
481 const char *remote_port = NULL;
482 const char *connect_timeout =
"60s";
483 const char *remote_allow_migrate=NULL;
484 const char *is_managed = NULL;
486 for (attr_set = pcmk__xe_first_child(xml_obj); attr_set != NULL;
487 attr_set = pcmk__xe_next(attr_set)) {
494 for (attr = pcmk__xe_first_child(attr_set); attr != NULL;
495 attr = pcmk__xe_next(attr)) {
502 remote_server = value;
506 connect_timeout = value;
508 remote_allow_migrate=value;
515 if (remote_name == NULL) {
524 remote_allow_migrate, is_managed,
525 connect_timeout, remote_server, remote_port);
557 xmlNode *xml_obj = NULL;
559 const char *
id = NULL;
560 const char *
uname = NULL;
561 const char *
type = NULL;
562 const char *score = NULL;
564 for (xml_obj = pcmk__xe_first_child(xml_nodes); xml_obj != NULL;
565 xml_obj = pcmk__xe_next(xml_obj)) {
578 "> entry in configuration without id");
583 if (new_node == NULL) {
587 handle_startup_fencing(
data_set, new_node);
589 add_node_attrs(xml_obj, new_node, FALSE,
data_set);
596 crm_info(
"Creating a fake local node");
607 const char *container_id = NULL;
622 pe_rsc_trace(rsc,
"Resource %s's container is %s", rsc->
id, container_id);
624 pe_err(
"Resource %s: Unknown resource container (%s)", rsc->
id, container_id);
632 xmlNode *xml_obj = NULL;
637 for (xml_obj = pcmk__xe_first_child(xml_resources); xml_obj != NULL;
638 xml_obj = pcmk__xe_next(xml_obj)) {
640 const char *new_node_id = NULL;
646 new_node_id =
ID(xml_obj);
650 crm_trace(
"Found remote node %s defined by resource %s",
651 new_node_id,
ID(xml_obj));
666 new_node_id = expand_remote_rsc_meta(xml_obj, xml_resources,
data_set);
668 crm_trace(
"Found guest node %s in resource %s",
669 new_node_id,
ID(xml_obj));
680 xmlNode *xml_obj2 = NULL;
681 for (xml_obj2 = pcmk__xe_first_child(xml_obj); xml_obj2 != NULL;
682 xml_obj2 = pcmk__xe_next(xml_obj2)) {
684 new_node_id = expand_remote_rsc_meta(xml_obj2, xml_resources,
data_set);
687 crm_trace(
"Found guest node %s in resource %s inside group %s",
688 new_node_id,
ID(xml_obj2),
ID(xml_obj));
723 pe_rsc_trace(new_rsc,
"Linking remote connection resource %s to %s",
724 new_rsc->
id, pe__node_name(remote_node));
731 handle_startup_fencing(
data_set, remote_node);
738 strdup(
"container"));
743 destroy_tag(gpointer
data)
749 g_list_free_full(tag->
refs, free);
769 xmlNode *xml_obj = NULL;
774 for (xml_obj = pcmk__xe_first_child(xml_resources); xml_obj != NULL;
775 xml_obj = pcmk__xe_next(xml_obj)) {
778 const char *
id =
ID(xml_obj);
780 if (pcmk__str_empty(
id)) {
782 crm_element_name(xml_obj));
789 NULL, NULL) == FALSE) {
797 crm_element_name(xml_obj),
id);
805 "because configuration is invalid",
806 crm_element_name(xml_obj),
id);
825 pcmk__config_err(
"Resource start-up disabled since no STONITH resources have been defined");
826 pcmk__config_err(
"Either configure some or disable STONITH with the stonith-enabled option");
827 pcmk__config_err(
"NOTE: Clusters with shared data need STONITH to ensure data integrity");
836 xmlNode *xml_tag = NULL;
840 for (xml_tag = pcmk__xe_first_child(xml_tags); xml_tag != NULL;
841 xml_tag = pcmk__xe_next(xml_tag)) {
843 xmlNode *xml_obj_ref = NULL;
844 const char *tag_id =
ID(xml_tag);
850 if (tag_id == NULL) {
852 crm_element_name(xml_tag));
856 for (xml_obj_ref = pcmk__xe_first_child(xml_tag); xml_obj_ref != NULL;
857 xml_obj_ref = pcmk__xe_next(xml_obj_ref)) {
859 const char *obj_ref =
ID(xml_obj_ref);
865 if (obj_ref == NULL) {
867 crm_element_name(xml_obj_ref), tag_id);
885 const char *ticket_id = NULL;
886 const char *granted = NULL;
887 const char *last_granted = NULL;
888 const char *standby = NULL;
889 xmlAttrPtr xIter = NULL;
893 ticket_id =
ID(xml_ticket);
894 if (pcmk__str_empty(ticket_id)) {
898 crm_trace(
"Processing ticket state for %s", ticket_id);
901 if (ticket == NULL) {
903 if (ticket == NULL) {
908 for (xIter = xml_ticket->properties; xIter; xIter = xIter->next) {
909 const char *prop_name = (
const char *)xIter->name;
915 g_hash_table_replace(ticket->
state, strdup(prop_name), strdup(prop_value));
918 granted = g_hash_table_lookup(ticket->
state,
"granted");
924 crm_info(
"We do not have ticket '%s'", ticket->
id);
927 last_granted = g_hash_table_lookup(ticket->
state,
"last-granted");
929 long long last_granted_ll;
935 standby = g_hash_table_lookup(ticket->
state,
"standby");
939 crm_info(
"Granted ticket '%s' is in standby-mode", ticket->
id);
945 crm_trace(
"Done with ticket state for %s", ticket_id);
953 xmlNode *xml_obj = NULL;
955 for (xml_obj = pcmk__xe_first_child(xml_tickets); xml_obj != NULL;
956 xml_obj = pcmk__xe_next(xml_obj)) {
961 unpack_ticket_state(xml_obj,
data_set);
968 unpack_handle_remote_attrs(
pe_node_t *this_node,
const xmlNode *state,
971 const char *resource_discovery_enabled = NULL;
972 const xmlNode *attrs = NULL;
982 crm_trace(
"Processing Pacemaker Remote node %s", pe__node_name(this_node));
993 add_node_attrs(attrs, this_node, TRUE,
data_set);
996 crm_info(
"%s is shutting down", pe__node_name(this_node));
1001 crm_info(
"%s is in standby mode", pe__node_name(this_node));
1007 crm_info(
"%s is in maintenance mode", pe__node_name(this_node));
1012 if (resource_discovery_enabled && !
crm_is_true(resource_discovery_enabled)) {
1016 " attribute on Pacemaker Remote node %s" 1017 " because fencing is disabled",
1018 pe__node_name(this_node));
1025 crm_info(
"%s has resource discovery disabled",
1026 pe__node_name(this_node));
1041 unpack_transient_attributes(
const xmlNode *state,
pe_node_t *node,
1044 const char *discovery = NULL;
1048 add_node_attrs(attrs, node, TRUE,
data_set);
1051 crm_info(
"%s is in standby mode", pe__node_name(node));
1056 crm_info(
"%s is in maintenance mode", pe__node_name(node));
1061 if ((discovery != NULL) && !
crm_is_true(discovery)) {
1063 " attribute for %s because disabling resource discovery " 1064 "is not allowed for cluster nodes", pe__node_name(node));
1083 const char *
id = NULL;
1084 const char *
uname = NULL;
1095 if (
uname == NULL) {
1102 if (this_node == NULL) {
1104 "it is no longer in the configuration",
uname);
1119 unpack_transient_attributes(state, this_node,
data_set);
1127 crm_trace(
"Determining online status of cluster node %s (id %s)",
1128 pe__node_name(this_node),
id);
1129 determine_online_status(state, this_node,
data_set);
1161 unpack_node_history(
const xmlNode *status,
bool fence,
1170 const char *
id =
ID(state);
1174 if ((
id == NULL) || (
uname == NULL)) {
1176 crm_trace(
"Not unpacking resource history from malformed " 1182 if (this_node == NULL) {
1184 crm_trace(
"Not unpacking resource history for node %s because " 1185 "no longer in configuration",
id);
1190 crm_trace(
"Not unpacking resource history for node %s because " 1191 "already unpacked",
id);
1207 crm_trace(
"Not unpacking resource history for guest node %s " 1208 "because container and connection are not known to " 1224 crm_trace(
"Not unpacking resource history for remote node %s " 1225 "because connection is not known to be up",
id);
1237 crm_trace(
"Not unpacking resource history for offline " 1238 "cluster node %s",
id);
1243 determine_remote_online_status(
data_set, this_node);
1244 unpack_handle_remote_attrs(this_node, state,
data_set);
1247 crm_trace(
"Unpacking resource history for %snode %s",
1248 (fence?
"unseen " :
""),
id);
1251 unpack_node_lrm(this_node, state,
data_set);
1264 xmlNode *state = NULL;
1272 for (state = pcmk__xe_first_child(status); state != NULL;
1273 state = pcmk__xe_next(state)) {
1276 unpack_tickets_state((xmlNode *) state,
data_set);
1279 unpack_node_state(state,
data_set);
1283 while (unpack_node_history(status, FALSE,
data_set) == EAGAIN) {
1284 crm_trace(
"Another pass through node resource histories is needed");
1288 unpack_node_history(status,
1298 pe_node_t *node = pe__current_node(container);
1312 for (GList *gIter =
data_set->
nodes; gIter != NULL; gIter = gIter->next) {
1324 determine_remote_online_status(
data_set, this_node);
1333 const xmlNode *node_state,
1336 gboolean online = FALSE;
1343 crm_trace(
"Node is down: in_cluster=%s",
1344 pcmk__s(in_cluster,
"<null>"));
1350 crm_debug(
"Node is not ready to run resources: %s", join);
1355 "in_cluster=%s is_peer=%s join=%s expected=%s",
1356 pcmk__s(in_cluster,
"<null>"), pcmk__s(is_peer,
"<null>"),
1357 pcmk__s(join,
"<null>"), pcmk__s(exp_state,
"<null>"));
1362 crm_info(
"in_cluster=%s is_peer=%s join=%s expected=%s",
1363 pcmk__s(in_cluster,
"<null>"), pcmk__s(is_peer,
"<null>"),
1364 pcmk__s(join,
"<null>"), pcmk__s(exp_state,
"<null>"));
1371 const xmlNode *node_state,
pe_node_t *this_node)
1373 gboolean online = FALSE;
1374 gboolean do_terminate = FALSE;
1375 bool crmd_online = FALSE;
1390 do_terminate = TRUE;
1392 }
else if (terminate != NULL && strlen(terminate) > 0) {
1394 char t = terminate[0];
1396 if (t !=
'0' && isdigit(t)) {
1397 do_terminate = TRUE;
1401 crm_trace(
"%s: in_cluster=%s is_peer=%s join=%s expected=%s term=%d",
1402 pe__node_name(this_node), pcmk__s(in_cluster,
"<null>"),
1403 pcmk__s(is_peer,
"<null>"), pcmk__s(join,
"<null>"),
1404 pcmk__s(exp_state,
"<null>"), do_terminate);
1408 if (exp_state == NULL) {
1413 crm_debug(
"%s is shutting down", pe__node_name(this_node));
1416 online = crmd_online;
1418 }
else if (in_cluster == NULL) {
1423 "peer failed Pacemaker membership criteria", FALSE);
1428 crm_info(
"- %s is not ready to run resources",
1429 pe__node_name(this_node));
1434 crm_trace(
"%s is down or still coming up",
1435 pe__node_name(this_node));
1439 &&
crm_is_true(in_cluster) == FALSE && !crmd_online) {
1440 crm_info(
"%s was just shot", pe__node_name(this_node));
1447 }
else if (!crmd_online) {
1451 }
else if (do_terminate) {
1455 crm_info(
"%s is active", pe__node_name(this_node));
1458 crm_info(
"%s is not ready to run resources", pe__node_name(this_node));
1464 crm_warn(
"%s: in-cluster=%s is-peer=%s join=%s expected=%s term=%d shutdown=%d",
1465 pe__node_name(this_node), pcmk__s(in_cluster,
"<null>"),
1466 pcmk__s(is_peer,
"<null>"), pcmk__s(join,
"<null>"),
1467 pcmk__s(exp_state,
"<null>"), do_terminate,
1487 goto remote_online_done;
1492 if (container && pcmk__list_of_1(rsc->
running_on)) {
1498 crm_trace(
"%s node %s presumed ONLINE because connection resource is started",
1499 (container?
"Guest" :
"Remote"), this_node->
details->
id);
1505 crm_trace(
"%s node %s shutting down because connection resource is stopping",
1506 (container?
"Guest" :
"Remote"), this_node->
details->
id);
1512 crm_trace(
"Guest node %s UNCLEAN because guest resource failed",
1518 crm_trace(
"%s node %s OFFLINE because connection resource failed",
1519 (container?
"Guest" :
"Remote"), this_node->
details->
id);
1525 crm_trace(
"%s node %s OFFLINE because its resource is stopped",
1526 (container?
"Guest" :
"Remote"), this_node->
details->
id);
1530 }
else if (
host && (
host->details->online == FALSE)
1531 &&
host->details->unclean) {
1532 crm_trace(
"Guest node %s UNCLEAN because host is unclean",
1544 determine_online_status(
const xmlNode *node_state,
pe_node_t *this_node,
1547 gboolean online = FALSE;
1570 online = determine_online_status_no_fencing(
data_set, node_state, this_node);
1573 online = determine_online_status_fencing(
data_set, node_state, this_node);
1581 this_node->
fixed = TRUE;
1587 this_node->
fixed = TRUE;
1592 crm_info(
"%s is not a Pacemaker node", pe__node_name(this_node));
1595 pe_proc_warn(
"%s is unclean", pe__node_name(this_node));
1598 crm_info(
"%s is %s", pe__node_name(this_node),
1605 crm_trace(
"%s is offline", pe__node_name(this_node));
1620 if (!pcmk__str_empty(
id)) {
1621 const char *end =
id + strlen(
id) - 1;
1623 for (
const char *s = end; s >
id; --s) {
1637 return (s == end)? s : (s - 1);
1661 char *basename = NULL;
1664 basename =
strndup(last_rsc_id, end - last_rsc_id + 1);
1683 size_t base_name_len = end - last_rsc_id + 1;
1687 zero = calloc(base_name_len + 3,
sizeof(
char));
1689 memcpy(zero, last_rsc_id, base_name_len);
1690 zero[base_name_len] =
':';
1691 zero[base_name_len + 1] =
'0';
1696 create_fake_resource(
const char *rsc_id,
const xmlNode *rsc_entry,
1713 crm_debug(
"Detected orphaned remote node %s", rsc_id);
1718 link_rsc2remotenode(
data_set, rsc);
1721 crm_trace(
"Setting node %s as shutting down due to orphaned connection resource", rsc_id);
1728 crm_trace(
"Detected orphaned container filler %s", rsc_id);
1757 top->
id,
parent->id, rsc_id, pe__node_name(node));
1779 GList *rIter = NULL;
1782 gboolean skip_inactive = FALSE;
1790 rsc_id, pe__node_name(node),
parent->id);
1791 for (rIter =
parent->children; rsc == NULL && rIter; rIter = rIter->next) {
1792 GList *locations = NULL;
1836 crm_notice(
"Active (now-)anonymous clone %s has " 1837 "multiple (orphan) instance histories on %s",
1838 parent->id, pe__node_name(node));
1839 skip_inactive = TRUE;
1846 g_list_free(locations);
1850 if (!skip_inactive && !inactive_instance
1853 inactive_instance =
parent->fns->find_rsc(child, rsc_id, NULL,
1859 if (inactive_instance && inactive_instance->
pending_node 1861 inactive_instance = NULL;
1867 if ((rsc == NULL) && !skip_inactive && (inactive_instance != NULL)) {
1869 rsc = inactive_instance;
1922 crm_trace(
"%s is not known as %s either (orphan)",
1928 crm_trace(
"Resource history for %s is orphaned because it is no longer primitive",
1936 if (pe_rsc_is_anon_clone(
parent)) {
1938 if (pe_rsc_is_bundled(
parent)) {
1953 pe_rsc_debug(rsc,
"Internally renamed %s on %s to %s%s",
1954 rsc_id, pe__node_name(node), rsc->
id,
1961 process_orphan_resource(
const xmlNode *rsc_entry,
const pe_node_t *node,
1967 crm_debug(
"Detected orphan resource %s on %s", rsc_id, pe__node_name(node));
1968 rsc = create_fake_resource(rsc_id, rsc_entry,
data_set);
1989 char *reason = NULL;
1993 pe_rsc_trace(rsc,
"Resource %s is %s on %s: on_fail=%s",
2007 ((rsc->
clone_name == NULL)?
"" :
" also known as "),
2025 gboolean should_fence = FALSE;
2036 should_fence = TRUE;
2050 " revoked if remote connection can " 2051 "be re-established elsewhere)",
2054 should_fence = TRUE;
2058 if (reason == NULL) {
2067 save_on_fail = on_fail;
2129 if (rsc->
container && pe_rsc_is_bundled(rsc)) {
2159 "remote connection is unrecoverable", FALSE);
2191 rsc->
id, pe__node_name(node));
2194 "%s because cluster is configured not to " 2195 "stop active orphans",
2196 rsc->
id, pe__node_name(node));
2225 GList *gIter = possible_matches;
2227 for (; gIter != NULL; gIter = gIter->next) {
2233 g_list_free(possible_matches);
2252 int start_index,
int stop_index,
2256 const char *task = NULL;
2257 const char *status = NULL;
2258 GList *gIter = sorted_op_list;
2261 pe_rsc_trace(rsc,
"%s: Start index %d, stop index = %d", rsc->
id, start_index, stop_index);
2263 for (; gIter != NULL; gIter = gIter->next) {
2264 xmlNode *rsc_op = (xmlNode *) gIter->data;
2266 guint interval_ms = 0;
2268 const char *
id =
ID(rsc_op);
2273 pe_rsc_trace(rsc,
"Skipping %s on %s: node is offline",
2274 rsc->
id, pe__node_name(node));
2278 }
else if (start_index < stop_index && counter <= stop_index) {
2279 pe_rsc_trace(rsc,
"Skipping %s on %s: resource is not active",
2280 id, pe__node_name(node));
2283 }
else if (counter < start_index) {
2285 id, pe__node_name(node), counter);
2290 if (interval_ms == 0) {
2292 id, pe__node_name(node));
2299 id, pe__node_name(node));
2305 pe_rsc_trace(rsc,
"Creating %s on %s", key, pe__node_name(node));
2315 int implied_monitor_start = -1;
2316 int implied_clone_start = -1;
2317 const char *task = NULL;
2318 const char *status = NULL;
2323 for (
const GList *iter = sorted_op_list; iter != NULL; iter = iter->next) {
2324 const xmlNode *rsc_op = (
const xmlNode *) iter->data;
2333 *stop_index = counter;
2336 *start_index = counter;
2342 implied_monitor_start = counter;
2345 implied_clone_start = counter;
2349 if (*start_index == -1) {
2350 if (implied_clone_start != -1) {
2351 *start_index = implied_clone_start;
2352 }
else if (implied_monitor_start != -1) {
2353 *start_index = implied_monitor_start;
2360 unpack_shutdown_lock(
const xmlNode *rsc_entry,
pe_resource_t *rsc,
2363 time_t lock_time = 0;
2366 &lock_time) ==
pcmk_ok) && (lock_time != 0)) {
2371 pe_rsc_info(rsc,
"Shutdown lock for %s on %s expired",
2372 rsc->
id, pe__node_name(node));
2396 unpack_lrm_resource(
pe_node_t *node,
const xmlNode *lrm_resource,
2399 GList *gIter = NULL;
2400 int stop_index = -1;
2401 int start_index = -1;
2404 const char *rsc_id =
ID(lrm_resource);
2407 GList *op_list = NULL;
2408 GList *sorted_op_list = NULL;
2410 xmlNode *rsc_op = NULL;
2411 xmlNode *last_failure = NULL;
2416 if (rsc_id == NULL) {
2418 " entry without id");
2422 rsc_id, pe__node_name(node));
2428 op_list = g_list_prepend(op_list, rsc_op);
2432 if (op_list == NULL) {
2439 rsc = unpack_find_resource(
data_set, node, rsc_id);
2441 if (op_list == NULL) {
2445 rsc = process_orphan_resource(lrm_resource, node,
data_set);
2452 unpack_shutdown_lock(lrm_resource, rsc, node,
data_set);
2456 saved_role = rsc->
role;
2460 for (gIter = sorted_op_list; gIter != NULL; gIter = gIter->next) {
2461 xmlNode *rsc_op = (xmlNode *) gIter->data;
2463 unpack_rsc_op(rsc, node, rsc_op, &last_failure, &on_fail);
2468 process_recurring(node, rsc, start_index, stop_index, sorted_op_list,
data_set);
2471 g_list_free(sorted_op_list);
2473 process_rsc_state(rsc, node, on_fail);
2480 pe_rsc_info(rsc,
"%s: Not overwriting calculated next role %s" 2481 " with requested next role %s",
2486 if (saved_role > rsc->
role) {
2487 rsc->
role = saved_role;
2494 handle_orphaned_container_fillers(
const xmlNode *lrm_rsc_list,
2497 for (
const xmlNode *rsc_entry = pcmk__xe_first_child(lrm_rsc_list);
2498 rsc_entry != NULL; rsc_entry = pcmk__xe_next(rsc_entry)) {
2503 const char *container_id;
2511 if (container_id == NULL || rsc_id == NULL) {
2516 if (container == NULL) {
2527 pe_rsc_trace(rsc,
"Mapped container of orphaned resource %s to %s",
2528 rsc->
id, container_id);
2545 bool found_orphaned_container_filler =
false;
2565 found_orphaned_container_filler =
true;
2572 if (found_orphaned_container_filler) {
2573 handle_orphaned_container_fillers(xml,
data_set);
2590 set_node_score(gpointer key, gpointer value, gpointer user_data)
2593 int *score = user_data;
2598 #define XPATH_NODE_STATE "/" XML_TAG_CIB "/" XML_CIB_TAG_STATUS \ 2599 "/" XML_CIB_TAG_STATE 2600 #define SUB_XPATH_LRM_RESOURCE "/" XML_CIB_TAG_LRM \ 2601 "/" XML_LRM_TAG_RESOURCES \ 2602 "/" XML_LRM_TAG_RESOURCE 2603 #define SUB_XPATH_LRM_RSC_OP "/" XML_LRM_TAG_RSC_OP 2606 find_lrm_op(
const char *resource,
const char *op,
const char *node,
const char *source,
2609 GString *xpath = NULL;
2610 xmlNode *xml = NULL;
2612 CRM_CHECK((resource != NULL) && (op != NULL) && (node != NULL),
2615 xpath = g_string_sized_new(256);
2633 g_string_append_c(xpath,
']');
2638 g_string_free(xpath, TRUE);
2640 if (xml && target_rc >= 0) {
2654 find_lrm_resource(
const char *rsc_id,
const char *node_name,
2657 GString *xpath = NULL;
2658 xmlNode *xml = NULL;
2660 CRM_CHECK((rsc_id != NULL) && (node_name != NULL),
return NULL);
2662 xpath = g_string_sized_new(256);
2671 g_string_free(xpath, TRUE);
2688 xmlXPathObjectPtr search;
2689 GString *xpath = g_string_sized_new(256);
2697 result = (numXpathResults(search) == 0);
2699 g_string_free(xpath, TRUE);
2716 monitor_not_running_after(
const char *rsc_id,
const char *node_name,
2717 const xmlNode *xml_op,
bool same_node,
2742 non_monitor_after(
const char *rsc_id,
const char *node_name,
2743 const xmlNode *xml_op,
bool same_node,
2746 xmlNode *lrm_resource = NULL;
2748 lrm_resource = find_lrm_resource(rsc_id, node_name,
data_set);
2749 if (lrm_resource == NULL) {
2755 const char * task = NULL;
2786 newer_state_after_migrate(
const char *rsc_id,
const char *node_name,
2787 const xmlNode *migrate_to,
2788 const xmlNode *migrate_from,
2791 const xmlNode *xml_op = migrate_to;
2792 const char *source = NULL;
2793 const char *
target = NULL;
2794 bool same_node =
false;
2797 xml_op = migrate_from;
2808 xml_op = migrate_from;
2812 xml_op = migrate_to;
2817 xml_op = migrate_to;
2821 xml_op = migrate_from;
2829 return non_monitor_after(rsc_id, node_name, xml_op, same_node,
data_set)
2830 || monitor_not_running_after(rsc_id, node_name, xml_op, same_node,
2847 get_migration_node_names(
const xmlNode *entry,
const pe_node_t *source_node,
2849 const char **source_name,
const char **target_name)
2853 if ((*source_name == NULL) || (*target_name == NULL)) {
2854 crm_err(
"Ignoring resource history entry %s without " 2860 if ((source_node != NULL)
2861 && !pcmk__str_eq(*source_name, source_node->
details->
uname,
2863 crm_err(
"Ignoring resource history entry %s because " 2865 ID(entry), *source_name, pe__node_name(source_node));
2869 if ((target_node != NULL)
2870 && !pcmk__str_eq(*target_name, target_node->
details->
uname,
2872 crm_err(
"Ignoring resource history entry %s because " 2874 ID(entry), *target_name, pe__node_name(target_node));
2896 pe_rsc_trace(rsc,
"Dangling migration of %s requires stop on %s",
2897 rsc->
id, pe__node_name(node));
2910 unpack_migrate_to_success(
struct action_history *history)
2946 xmlNode *migrate_from = NULL;
2947 const char *source = NULL;
2948 const char *
target = NULL;
2949 bool source_newer_op =
false;
2950 bool target_newer_state =
false;
2951 bool active_on_target =
false;
2954 if (get_migration_node_names(history->xml, history->node, NULL, &source,
2960 source_newer_op = non_monitor_after(history->rsc->id, source, history->xml,
2961 true, history->rsc->cluster);
2965 source, -1, history->rsc->cluster);
2966 if (migrate_from != NULL) {
2967 if (source_newer_op) {
2982 target_newer_state = newer_state_after_migrate(history->rsc->id,
target,
2983 history->xml, migrate_from,
2984 history->rsc->cluster);
2985 if (source_newer_op && target_newer_state) {
2994 add_dangling_migration(history->rsc, history->node);
3004 active_on_target = !target_newer_state && (target_node != NULL)
3008 if (active_on_target) {
3026 && unknown_on_node(history->rsc,
target)) {
3030 if (active_on_target) {
3036 if ((source_node != NULL) && source_node->
details->
online) {
3043 history->rsc->partial_migration_target = target_node;
3044 history->rsc->partial_migration_source = source_node;
3047 }
else if (!source_newer_op) {
3061 unpack_migrate_to_failure(
struct action_history *history)
3063 xmlNode *target_migrate_from = NULL;
3064 const char *source = NULL;
3065 const char *
target = NULL;
3068 if (get_migration_node_names(history->xml, history->node, NULL, &source,
3081 history->rsc->cluster);
3088 !unknown_on_node(history->rsc,
target)
3092 && !newer_state_after_migrate(history->rsc->id,
target, history->xml,
3093 target_migrate_from,
3094 history->rsc->cluster)) {
3107 }
else if (!non_monitor_after(history->rsc->id, source, history->xml,
true,
3108 history->rsc->cluster)) {
3115 history->rsc->dangling_migrations =
3116 g_list_prepend(history->rsc->dangling_migrations,
3117 (gpointer) history->node);
3128 unpack_migrate_from_failure(
struct action_history *history)
3130 xmlNode *source_migrate_to = NULL;
3131 const char *source = NULL;
3132 const char *
target = NULL;
3135 if (get_migration_node_names(history->xml, NULL, history->node, &source,
3148 history->rsc->cluster);
3155 !unknown_on_node(history->rsc, source)
3159 && !newer_state_after_migrate(history->rsc->id, source,
3160 source_migrate_to, history->xml,
3161 history->rsc->cluster)) {
3182 record_failed_op(
struct action_history *history)
3184 if (!(history->node->details->online)) {
3188 for (
const xmlNode *xIter = history->rsc->cluster->failed->children;
3189 xIter != NULL; xIter = xIter->next) {
3191 const char *key = pe__xe_history_key(xIter);
3195 && pcmk__str_eq(
uname, history->node->details->uname,
3197 crm_trace(
"Skipping duplicate entry %s on %s",
3198 history->key, pe__node_name(history->node));
3203 crm_trace(
"Adding entry for %s on %s to failed action list",
3204 history->key, pe__node_name(history->node));
3211 last_change_str(
const xmlNode *xml_op)
3219 const char *p = strchr(when_s,
' ');
3222 if ((p != NULL) && (*(++p) !=
'\0')) {
3230 result = strdup(
"unknown time");
3324 return first - second;
3339 if (fail_rsc->
parent != NULL) {
3342 if (pe_rsc_is_anon_clone(
parent)) {
3351 crm_notice(
"%s will not be started under current conditions", fail_rsc->
id);
3356 g_hash_table_foreach(fail_rsc->
allowed_nodes, set_node_score, &score);
3368 unpack_rsc_op_failure(
struct action_history *history, xmlNode **last_failure,
3371 bool is_probe =
false;
3373 char *last_change_s = NULL;
3375 *last_failure = history->xml;
3378 last_change_s = last_change_str(history->xml);
3382 crm_trace(
"Unexpected result (%s%s%s) was recorded for " 3383 "%s of %s on %s at %s " CRM_XS " exit-status=%d id=%s",
3384 services_ocf_exitcode_str(history->exit_status),
3385 (pcmk__str_empty(history->exit_reason)?
"" :
": "),
3386 pcmk__s(history->exit_reason,
""),
3387 (is_probe?
"probe" : history->task), history->rsc->id,
3388 pe__node_name(history->node), last_change_s,
3389 history->exit_status, history->id);
3391 crm_warn(
"Unexpected result (%s%s%s) was recorded for " 3392 "%s of %s on %s at %s " CRM_XS " exit-status=%d id=%s",
3393 services_ocf_exitcode_str(history->exit_status),
3394 (pcmk__str_empty(history->exit_reason)?
"" :
": "),
3395 pcmk__s(history->exit_reason,
""),
3396 (is_probe?
"probe" : history->task), history->rsc->id,
3397 pe__node_name(history->node), last_change_s,
3398 history->exit_status, history->id);
3400 if (is_probe && (history->exit_status !=
PCMK_OCF_OK)
3407 crm_notice(
"If it is not possible for %s to run on %s, see " 3408 "the resource-discovery option for location constraints",
3409 history->rsc->id, pe__node_name(history->node));
3412 record_failed_op(history);
3415 free(last_change_s);
3418 NULL, TRUE, FALSE, history->rsc->cluster);
3419 if (cmp_on_fail(*on_fail,
action->on_fail) < 0) {
3420 pe_rsc_trace(history->rsc,
"on-fail %s -> %s for %s (%s)",
3422 action->uuid, history->key);
3423 *on_fail =
action->on_fail;
3428 "__stop_fail__", history->rsc->cluster);
3431 unpack_migrate_to_failure(history);
3434 unpack_migrate_from_failure(history);
3443 "demote with on-fail=block");
3460 pe_rsc_trace(history->rsc,
"Leaving %s stopped", history->rsc->id);
3464 pe_rsc_trace(history->rsc,
"Setting %s active", history->rsc->id);
3465 set_active(history->rsc);
3469 "Resource %s: role=%s, unclean=%s, on_fail=%s, fail_role=%s",
3470 history->rsc->id,
role2text(history->rsc->role),
3471 pcmk__btoa(history->node->details->unclean),
3475 && (history->rsc->next_role <
action->fail_role)) {
3480 ban_from_all_nodes(history->rsc);
3496 block_if_unrecoverable(
struct action_history *history)
3498 char *last_change_s = NULL;
3503 if (
pe_can_fence(history->node->details->data_set, history->node)) {
3507 last_change_s = last_change_str(history->xml);
3508 pe_proc_err(
"No further recovery can be attempted for %s " 3509 "because %s on %s failed (%s%s%s) at %s " 3511 history->rsc->id, history->task, pe__node_name(history->node),
3512 services_ocf_exitcode_str(history->exit_status),
3513 (pcmk__str_empty(history->exit_reason)?
"" :
": "),
3514 pcmk__s(history->exit_reason,
""),
3515 last_change_s, history->exit_status, history->id);
3517 free(last_change_s);
3533 remap_because(
struct action_history *history,
const char **why,
int value,
3536 if (history->execution_status != value) {
3537 history->execution_status = value;
3565 remap_operation(
struct action_history *history,
3568 bool is_probe =
false;
3569 int orig_exit_status = history->exit_status;
3570 int orig_exec_status = history->execution_status;
3571 const char *why = NULL;
3572 const char *task = history->task;
3576 if (history->exit_status != orig_exit_status) {
3577 why =
"degraded result";
3578 if (!expired && (!history->node->details->shutdown
3579 || history->node->details->online)) {
3580 record_failed_op(history);
3584 if (!pe_rsc_is_bundled(history->rsc)
3590 why =
"equivalent probe result";
3598 switch (history->execution_status) {
3607 "node-fatal error");
3619 if (history->expected_exit_status < 0) {
3629 "obsolete history format");
3630 crm_warn(
"Expected result not found for %s on %s " 3631 "(corrupt or obsolete CIB?)",
3632 history->key, pe__node_name(history->node));
3634 }
else if (history->exit_status == history->expected_exit_status) {
3640 "%s on %s: expected %d (%s), got %d (%s%s%s)",
3641 history->key, pe__node_name(history->node),
3642 history->expected_exit_status,
3643 services_ocf_exitcode_str(history->expected_exit_status),
3644 history->exit_status,
3645 services_ocf_exitcode_str(history->exit_status),
3646 (pcmk__str_empty(history->exit_reason)?
"" :
": "),
3647 pcmk__s(history->exit_reason,
""));
3650 switch (history->exit_status) {
3654 char *last_change_s = last_change_str(history->xml);
3657 pe_rsc_info(history->rsc,
"Probe found %s active on %s at %s",
3658 history->rsc->id, pe__node_name(history->node),
3660 free(last_change_s);
3666 || (history->expected_exit_status == history->exit_status)
3683 && (history->exit_status != history->expected_exit_status)) {
3684 char *last_change_s = last_change_str(history->xml);
3688 "Probe found %s active and promoted on %s at %s",
3689 history->rsc->id, pe__node_name(history->node),
3691 free(last_change_s);
3694 || (history->exit_status == history->expected_exit_status)) {
3712 guint interval_ms = 0;
3716 if (interval_ms == 0) {
3718 block_if_unrecoverable(history);
3733 block_if_unrecoverable(history);
3740 char *last_change_s = last_change_str(history->xml);
3742 crm_info(
"Treating unknown exit status %d from %s of %s " 3743 "on %s at %s as failure",
3744 history->exit_status, task, history->rsc->id,
3745 pe__node_name(history->node), last_change_s);
3747 "unknown exit status");
3748 free(last_change_s);
3756 "Remapped %s result from [%s: %s] to [%s: %s] " 3758 history->key, pcmk_exec_status_str(orig_exec_status),
3760 pcmk_exec_status_str(history->execution_status),
3767 should_clear_for_param_change(
const xmlNode *xml_op,
const char *task,
3770 if (!strcmp(task,
"start") || !strcmp(task,
"monitor")) {
3785 switch (digest_data->
rc) {
3787 crm_trace(
"Resource %s history entry %s on %s" 3788 " has no digest to compare",
3789 rsc->
id, pe__xe_history_key(xml_op),
3818 should_ignore_failure_timeout(
const pe_resource_t *rsc,
const char *task,
3819 guint interval_ms,
bool is_last_failure)
3848 if (is_last_failure) {
3849 crm_info(
"Waiting to clear monitor failure for remote node %s" 3850 " until fencing has occurred", rsc->
id);
3877 check_operation_expiry(
struct action_history *history)
3879 bool expired =
false;
3880 bool is_last_failure =
pcmk__ends_with(history->id,
"_last_failure_0");
3881 time_t last_run = 0;
3882 int unexpired_fail_count = 0;
3883 const char *clear_reason = NULL;
3887 "Resource history entry %s on %s is not expired: " 3888 "Not Installed does not expire",
3889 history->id, pe__node_name(history->node));
3893 if ((history->rsc->failure_timeout > 0)
3900 time_t last_failure = 0;
3903 if ((now >= (last_run + history->rsc->failure_timeout))
3904 && !should_ignore_failure_timeout(history->rsc, history->task,
3905 history->interval_ms,
3916 crm_trace(
"%s@%lld is %sexpired @%lld with unexpired_failures=%d timeout=%ds" 3917 " last-failure@%lld",
3918 history->id, (
long long) last_run, (expired?
"" :
"not "),
3919 (
long long) now, unexpired_fail_count,
3920 history->rsc->failure_timeout, (
long long) last_failure);
3921 last_failure += history->rsc->failure_timeout + 1;
3922 if (unexpired_fail_count && (now < last_failure)) {
3932 if (unexpired_fail_count == 0) {
3934 clear_reason =
"it expired";
3944 "Resource history entry %s on %s is not expired: " 3945 "Unexpired fail count",
3946 history->id, pe__node_name(history->node));
3950 }
else if (is_last_failure
3951 && (history->rsc->remote_reconnect_ms != 0)) {
3955 clear_reason =
"reconnect interval is set";
3959 if (!expired && is_last_failure
3960 && should_clear_for_param_change(history->xml, history->task,
3961 history->rsc, history->node)) {
3962 clear_reason =
"resource parameters have changed";
3965 if (clear_reason != NULL) {
3969 history->rsc->cluster);
3972 && (history->rsc->remote_reconnect_ms != 0)) {
3981 crm_info(
"Clearing %s failure will wait until any scheduled " 3982 "fencing of %s completes",
3983 history->task, history->rsc->id);
3984 order_after_remote_fencing(clear_op, history->rsc,
3985 history->rsc->cluster);
3989 if (expired && (history->interval_ms == 0)
3991 switch (history->exit_status) {
3999 "Resource history entry %s on %s is not expired: " 4001 history->id, pe__node_name(history->node));
4032 get_action_on_fail(
struct action_history *history)
4036 history->task, NULL, TRUE, FALSE,
4037 history->rsc->cluster);
4054 update_resource_state(
struct action_history *history,
int exit_status,
4055 const xmlNode *last_failure,
4058 bool clear_past_failure =
false;
4061 || (!pe_rsc_is_bundled(history->rsc)
4066 clear_past_failure =
true;
4070 if ((last_failure != NULL)
4071 && pcmk__str_eq(history->key, pe__xe_history_key(last_failure),
4073 clear_past_failure =
true;
4076 set_active(history->rsc);
4081 clear_past_failure =
true;
4085 clear_past_failure =
true;
4090 clear_past_failure =
true;
4096 clear_past_failure =
true;
4103 clear_past_failure =
true;
4107 unpack_migrate_to_success(history);
4111 history->rsc->id, pe__node_name(history->node));
4112 set_active(history->rsc);
4115 if (!clear_past_failure) {
4125 "%s (%s) is not cleared by a completed %s",
4126 history->rsc->id,
fail2text(*on_fail), history->task);
4136 "clear past failures");
4140 if (history->rsc->remote_reconnect_ms == 0) {
4149 "clear past failures and reset remote");
4164 can_affect_state(
struct action_history *history)
4193 unpack_action_result(
struct action_history *history)
4196 &(history->execution_status)) < 0)
4200 crm_err(
"Ignoring resource history entry %s for %s on %s " 4202 history->id, history->rsc->id, pe__node_name(history->node),
4208 &(history->exit_status)) < 0)
4209 || (history->exit_status < 0) || (history->exit_status >
CRM_EX_MAX)) {
4215 crm_err(
"Ignoring resource history entry %s for %s on %s " 4217 history->id, history->rsc->id, pe__node_name(history->node),
4241 process_expired_result(
struct action_history *history,
int orig_exit_status)
4243 if (!pe_rsc_is_bundled(history->rsc)
4245 && (orig_exit_status != history->expected_exit_status)) {
4250 crm_trace(
"Ignoring resource history entry %s for probe of %s on %s: " 4251 "Masked failure expired",
4252 history->id, history->rsc->id,
4253 pe__node_name(history->node));
4257 if (history->exit_status == history->expected_exit_status) {
4261 if (history->interval_ms == 0) {
4262 crm_notice(
"Ignoring resource history entry %s for %s of %s on %s: " 4264 history->id, history->task, history->rsc->id,
4265 pe__node_name(history->node));
4269 if (history->node->details->online && !history->node->details->unclean) {
4280 crm_notice(
"Rescheduling %s-interval %s of %s on %s " 4281 "after failure expired",
4283 history->rsc->id, pe__node_name(history->node));
4285 "calculated-failure-timeout");
4302 mask_probe_failure(
struct action_history *history,
int orig_exit_status,
4303 const xmlNode *last_failure,
4312 crm_notice(
"Treating probe result '%s' for %s on %s as 'not running'",
4313 services_ocf_exitcode_str(orig_exit_status), history->rsc->id,
4314 pe__node_name(history->node));
4315 update_resource_state(history, history->expected_exit_status, last_failure,
4319 record_failed_op(history);
4321 history->rsc->cluster);
4336 failure_is_newer(
const struct action_history *history,
4337 const xmlNode *last_failure)
4339 guint failure_interval_ms = 0U;
4340 long long failure_change = 0LL;
4341 long long this_change = 0LL;
4343 if (last_failure == NULL) {
4347 if (!pcmk__str_eq(history->task,
4354 &failure_interval_ms) !=
pcmk_ok)
4355 || (history->interval_ms != failure_interval_ms)) {
4364 || (failure_change < this_change)) {
4379 process_pending_action(
struct action_history *history,
4380 const xmlNode *last_failure)
4391 if (failure_is_newer(history, last_failure)) {
4397 set_active(history->rsc);
4403 && history->node->details->unclean) {
4407 const char *migrate_target = NULL;
4418 if (history->rsc->pending_task != NULL) {
4432 history->rsc->pending_task = strdup(
"probe");
4433 history->rsc->pending_node = history->node;
4436 history->rsc->pending_task = strdup(history->task);
4437 history->rsc->pending_node = history->node;
4446 bool expired =
false;
4450 struct action_history history = {
4457 CRM_CHECK(rsc && node && xml_op,
return);
4459 history.id =
ID(xml_op);
4460 if (history.id == NULL) {
4461 crm_err(
"Ignoring resource history entry for %s on %s without ID",
4462 rsc->
id, pe__node_name(node));
4468 if (history.task == NULL) {
4469 crm_err(
"Ignoring resource history entry %s for %s on %s without " 4474 &(history.interval_ms));
4475 if (!can_affect_state(&history)) {
4477 "Ignoring resource history entry %s for %s on %s " 4478 "with irrelevant action '%s'",
4479 history.id, rsc->
id, pe__node_name(node), history.task);
4483 if (unpack_action_result(&history) !=
pcmk_rc_ok) {
4488 history.key = pe__xe_history_key(xml_op);
4491 pe_rsc_trace(rsc,
"Unpacking %s (%s call %d on %s): %s (%s)",
4492 history.id, history.task, history.call_id, pe__node_name(node),
4493 pcmk_exec_status_str(history.execution_status),
4498 "%s is running on %s, which is unclean (further action " 4499 "depends on value of stop's on-fail attribute)",
4500 rsc->
id, pe__node_name(node));
4503 expired = check_operation_expiry(&history);
4504 old_rc = history.exit_status;
4506 remap_operation(&history, on_fail, expired);
4508 if (expired && (process_expired_result(&history, old_rc) ==
pcmk_rc_ok)) {
4513 mask_probe_failure(&history, old_rc, *last_failure, on_fail);
4521 switch (history.execution_status) {
4523 process_pending_action(&history, *last_failure);
4527 update_resource_state(&history, history.exit_status, *last_failure,
4532 failure_strategy = get_action_on_fail(&history);
4534 crm_warn(
"Cannot ignore failed %s of %s on %s: " 4535 "Resource agent doesn't exist " 4536 CRM_XS " status=%d rc=%d id=%s",
4537 history.task, rsc->
id, pe__node_name(node),
4538 history.execution_status, history.exit_status,
4545 unpack_rsc_op_failure(&history, last_failure, on_fail);
4574 failure_strategy = get_action_on_fail(&history);
4579 char *last_change_s = last_change_str(xml_op);
4581 crm_warn(
"Pretending failed %s (%s%s%s) of %s on %s at %s succeeded " 4583 history.task, services_ocf_exitcode_str(history.exit_status),
4584 (pcmk__str_empty(history.exit_reason)?
"" :
": "),
4585 pcmk__s(history.exit_reason,
""), rsc->
id, pe__node_name(node),
4586 last_change_s, history.id);
4587 free(last_change_s);
4589 update_resource_state(&history, history.expected_exit_status,
4590 *last_failure, on_fail);
4594 record_failed_op(&history);
4598 *on_fail = failure_strategy;
4602 unpack_rsc_op_failure(&history, last_failure, on_fail);
4605 uint8_t log_level = LOG_ERR;
4608 log_level = LOG_NOTICE;
4611 "Preventing %s from restarting on %s because " 4612 "of hard failure (%s%s%s) " CRM_XS " %s",
4613 parent->id, pe__node_name(node),
4614 services_ocf_exitcode_str(history.exit_status),
4615 (pcmk__str_empty(history.exit_reason)?
"" :
": "),
4616 pcmk__s(history.exit_reason,
""), history.id);
4621 crm_err(
"Preventing %s from restarting anywhere because " 4622 "of fatal failure (%s%s%s) " CRM_XS " %s",
4623 parent->id, services_ocf_exitcode_str(history.exit_status),
4624 (pcmk__str_empty(history.exit_reason)?
"" :
": "),
4625 pcmk__s(history.exit_reason,
""), history.id);
4632 pe_rsc_trace(rsc,
"%s role on %s after %s is %s (next %s)",
4633 rsc->
id, pe__node_name(node), history.id,
4638 add_node_attrs(
const xmlNode *xml_obj,
pe_node_t *node,
bool overwrite,
4641 const char *cluster_name = NULL;
4670 strdup(cluster_name));
4688 }
else if (cluster_name) {
4692 strdup(cluster_name));
4698 extract_operations(
const char *node,
const char *rsc, xmlNode * rsc_entry, gboolean active_filter)
4701 int stop_index = -1;
4702 int start_index = -1;
4704 xmlNode *rsc_op = NULL;
4706 GList *gIter = NULL;
4707 GList *op_list = NULL;
4708 GList *sorted_op_list = NULL;
4712 sorted_op_list = NULL;
4714 for (rsc_op = pcmk__xe_first_child(rsc_entry);
4715 rsc_op != NULL; rsc_op = pcmk__xe_next(rsc_op)) {
4721 op_list = g_list_prepend(op_list, rsc_op);
4725 if (op_list == NULL) {
4733 if (active_filter == FALSE) {
4734 return sorted_op_list;
4741 for (gIter = sorted_op_list; gIter != NULL; gIter = gIter->next) {
4742 xmlNode *rsc_op = (xmlNode *) gIter->data;
4746 if (start_index < stop_index) {
4747 crm_trace(
"Skipping %s: not active",
ID(rsc_entry));
4750 }
else if (counter < start_index) {
4754 op_list = g_list_append(op_list, rsc_op);
4757 g_list_free(sorted_op_list);
4765 GList *output = NULL;
4766 GList *intermediate = NULL;
4768 xmlNode *tmp = NULL;
4773 xmlNode *node_state = NULL;
4775 for (node_state = pcmk__xe_first_child(status); node_state != NULL;
4776 node_state = pcmk__xe_next(node_state)) {
4786 if(this_node == NULL) {
4791 determine_remote_online_status(
data_set, this_node);
4794 determine_online_status(node_state, this_node,
data_set);
4803 xmlNode *lrm_rsc = NULL;
4808 for (lrm_rsc = pcmk__xe_first_child(tmp); lrm_rsc != NULL;
4809 lrm_rsc = pcmk__xe_next(lrm_rsc)) {
4811 if (pcmk__str_eq((
const char *)lrm_rsc->name,
4820 intermediate = extract_operations(
uname, rsc_id, lrm_rsc, active_filter);
4821 output = g_list_concat(output, intermediate);
gboolean get_target_role(const pe_resource_t *rsc, enum rsc_role_e *role)
#define CRM_CHECK(expr, failure_action)
#define XML_RSC_OP_LAST_CHANGE
void verify_pe_options(GHashTable *options)
enum pe_quorum_policy no_quorum_policy
Service failed and possibly in promoted role.
pe_node_t * pe_find_node_any(const GList *node_list, const char *id, const char *node_name)
Find a node by name or ID in a list of nodes.
#define crm_notice(fmt, args...)
#define CRMD_ACTION_MIGRATED
No connection to executor.
#define pe_flag_stop_action_orphans
bool pe__is_guest_or_remote_node(const pe_node_t *node)
#define pe_rsc_debug(rsc, fmt, args...)
#define XML_CONFIG_ATTR_SHUTDOWN_LOCK
Service active and promoted.
#define pe__set_action_flags(action, flags_to_set)
#define XML_NODE_IS_FENCED
int pcmk__scan_min_int(const char *text, int *result, int minimum)
#define stop_action(rsc, node, optional)
pe_resource_t * container
bool pcmk__strcase_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
pe_node_t * partial_migration_source
#define XML_ATTR_QUORUM_PANIC
#define pe_flag_concurrent_fencing
#define XML_CONFIG_ATTR_PRIORITY_FENCING_DELAY
void pe__update_recheck_time(time_t recheck, pe_working_set_t *data_set)
#define XML_TAG_UTILIZATION
gint pe__cmp_node_name(gconstpointer a, gconstpointer b)
#define pcmk__config_warn(fmt...)
#define XML_RULE_ATTR_SCORE
#define XML_BOOLEAN_FALSE
#define pe_flag_symmetric_cluster
int priority_fencing_delay
xmlNode * first_named_child(const xmlNode *parent, const char *name)
#define pe_flag_remove_after_stop
enum rsc_role_e next_role
#define pe_flag_maintenance_mode
void copy_in_properties(xmlNode *target, const xmlNode *src)
int pe__is_newer_op(const xmlNode *xml_a, const xmlNode *xml_b, bool same_node_default)
int char2score(const char *score)
Get the integer value of a score string.
#define pcmk__config_err(fmt...)
xmlNode * find_xml_node(const xmlNode *root, const char *search_path, gboolean must_find)
#define pe_proc_warn(fmt...)
pe_resource_t * remote_rsc
#define XML_TAG_TRANSIENT_NODEATTRS
#define CRMD_ACTION_NOTIFY
resource_object_functions_t * fns
#define XML_LRM_TAG_RESOURCE
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
pe_node_t * pe__copy_node(const pe_node_t *this_node)
bool pcmk_is_probe(const char *task, guint interval)
#define CRMD_ACTION_PROMOTE
gboolean unpack_tags(xmlNode *xml_tags, pe_working_set_t *data_set)
#define XML_NVPAIR_ATTR_NAME
#define SUB_XPATH_LRM_RSC_OP
#define XML_NODE_IS_MAINTENANCE
gint sort_op_by_callid(gconstpointer a, gconstpointer b)
#define XML_NODE_EXPECTED
#define XML_CIB_TAG_RSC_TEMPLATE
Necessary CIB secrets are unavailable.
const pe_resource_t * pe__const_top_resource(const pe_resource_t *rsc, bool include_bundle)
pe_resource_t * pe_find_resource(GList *rsc_list, const char *id_rh)
time_t get_effective_time(pe_working_set_t *data_set)
#define CRM_LOG_ASSERT(expr)
const char * pe_pref(GHashTable *options, const char *name)
Service promoted but more likely to fail soon.
gboolean unpack_remote_nodes(xmlNode *xml_resources, pe_working_set_t *data_set)
enum crm_ais_msg_types type
#define CRMD_JOINSTATE_NACK
#define CRM_ATTR_CLUSTER_NAME
Ensure crm_exit_t can hold this.
pe_node_t * partial_migration_target
void resource_location(pe_resource_t *rsc, const pe_node_t *node, int score, const char *tag, pe_working_set_t *data_set)
Action did not complete in time.
gboolean remote_was_fenced
int crm_element_value_int(const xmlNode *data, const char *name, int *dest)
Retrieve the integer value of an XML attribute.
Execution failed, do not retry on node.
bool pcmk__ends_with(const char *s, const char *match)
#define pe_flag_have_quorum
gboolean unpack_config(xmlNode *config, pe_working_set_t *data_set)
bool pe__bundle_needs_remote_name(pe_resource_t *rsc)
xmlNode * get_xpath_object(const char *xpath, xmlNode *xml_obj, int error_level)
#define pe_proc_err(fmt...)
gboolean remote_requires_reset
bool pe__shutdown_requested(const pe_node_t *node)
pe_working_set_t * data_set
Cluster that this node is part of.
char * strndup(const char *str, size_t len)
No fence device is configured for target.
#define pe__set_resource_flags(resource, flags_to_set)
#define XML_CIB_TAG_PROPSET
int pcmk__effective_rc(int rc)
#define pe_flag_stop_everything
#define XML_LRM_ATTR_RSCID
gboolean remote_maintenance
#define CRMD_ACTION_START
#define demote_action(rsc, node, optional)
bool pe__is_remote_node(const pe_node_t *node)
#define XML_TAG_ATTR_SETS
#define XML_LRM_ATTR_TASK
const char * role2text(enum rsc_role_e role)
xmlNode * pe_create_remote_xml(xmlNode *parent, const char *uname, const char *container_id, const char *migrateable, const char *is_managed, const char *start_timeout, const char *server, const char *port)
pe_node_t *(* location)(const pe_resource_t *, GList **, int)
pe_resource_t * pe__find_bundle_replica(const pe_resource_t *bundle, const pe_node_t *node)
bool pcmk_xe_mask_probe_failure(const xmlNode *xml_op)
int pcmk__scan_ll(const char *text, long long *result, long long default_value)
#define pe_flag_have_remote_nodes
GList * dangling_migrations
#define CRMD_JOINSTATE_DOWN
Maximum value for this enum.
#define crm_warn(fmt, args...)
guint remote_reconnect_ms
#define XML_CONFIG_ATTR_SHUTDOWN_LOCK_LIMIT
#define CRMD_ACTION_DEMOTE
const char * crm_exit_str(crm_exit_t exit_code)
char * clone_zero(const char *last_rsc_id)
bool pe_can_fence(const pe_working_set_t *data_set, const pe_node_t *node)
#define pe_rsc_allow_migrate
#define pe_rsc_orphan_container_filler
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 XML_RSC_ATTR_CONTAINER
Used only to initialize variables.
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
const char * pe_node_attribute_raw(const pe_node_t *node, const char *name)
#define XML_CIB_TAG_RESOURCE
#define pe_rsc_is_container
#define XML_CIB_TAG_STATE
const char * pe_base_name_end(const char *id)
bool pe__is_guest_node(const pe_node_t *node)
Parameter invalid (in local context)
match only clone instances
#define pe_rsc_start_pending
Parameter invalid (inherently)
#define pe_warn_once(pe_wo_bit, fmt...)
pe_ticket_t * ticket_new(const char *ticket_id, pe_working_set_t *data_set)
#define crm_trace(fmt, args...)
#define CRMD_JOINSTATE_MEMBER
#define do_crm_log(level, fmt, args...)
Log a message.
enum rsc_digest_cmp_val rc
void pcmk__g_strcat(GString *buffer,...) G_GNUC_NULL_TERMINATED
bool xml_contains_remote_node(xmlNode *xml)
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
xmlNode * add_node_copy(xmlNode *new_parent, xmlNode *xml_node)
pe_action_t * pe__clear_failcount(pe_resource_t *rsc, const pe_node_t *node, const char *reason, pe_working_set_t *data_set)
Schedule a controller operation to clear a fail count.
#define pe_flag_startup_fencing
const char * stonith_action
struct pe_node_shared_s * details
#define crm_log_xml_debug(xml, text)
#define pe_rsc_needs_fencing
gboolean order_actions(pe_action_t *lh_action, pe_action_t *rh_action, enum pe_ordering order)
#define pe_rsc_promotable
pe_working_set_t * data_set
#define XML_TAG_META_SETS
void pcmk__str_update(char **str, const char *value)
Wrappers for and extensions to libxml2.
gboolean add_tag_ref(GHashTable *tags, const char *tag_name, const char *obj_ref)
#define XML_RSC_ATTR_MANAGED
xmlNode * create_xml_node(xmlNode *parent, const char *name)
Action completed, result is known.
#define pe_flag_stonith_enabled
gboolean unpack_status(xmlNode *status, pe_working_set_t *data_set)
int crm_element_value_epoch(const xmlNode *xml, const char *name, time_t *dest)
Retrieve the seconds-since-epoch value of an XML attribute.
GHashTable * pe__node_list2table(const GList *list)
void pe__add_param_check(const xmlNode *rsc_op, pe_resource_t *rsc, pe_node_t *node, enum pe_check_parameters, pe_working_set_t *data_set)
bool pe__is_universal_clone(const pe_resource_t *rsc, const pe_working_set_t *data_set)
pe_resource_t * pe__create_clone_child(pe_resource_t *rsc, pe_working_set_t *data_set)
#define XML_RSC_ATTR_TARGET_ROLE
#define XML_LRM_ATTR_MIGRATE_TARGET
Execution failed, do not retry anywhere.
#define CIB_OPTIONS_FIRST
#define XML_RSC_ATTR_REMOTE_NODE
#define XML_LRM_ATTR_EXIT_REASON
#define XML_LRM_ATTR_RESTART_DIGEST
void pe__free_digests(gpointer ptr)
Dependencies not available locally.
enum pe_obj_types variant
bool pcmk__str_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
const char * placement_strategy
char * pcmk__op_key(const char *rsc_id, const char *op_type, guint interval_ms)
Generate an operation key (RESOURCE_ACTION_INTERVAL)
#define XML_ATTR_TRANSITION_KEY
gboolean rsc_discovery_enabled
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.
pe_node_t * pe_create_node(const char *id, const char *uname, const char *type, const char *score, pe_working_set_t *data_set)
Requested action not implemented.
int pe__target_rc_from_xml(const xmlNode *xml_op)
#define pe_flag_quick_location
Service active but more likely to fail soon.
pe_action_t * pe__clear_resource_history(pe_resource_t *rsc, const pe_node_t *node, pe_working_set_t *data_set)
const char * fail2text(enum action_fail_response fail)
Agent does not implement requested action.
GHashTable * pcmk__strkey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
pcmk__action_result_t result
G_GNUC_INTERNAL gint pe__cmp_rsc_priority(gconstpointer a, gconstpointer b)
void pe__unpack_node_health_scores(pe_working_set_t *data_set)
#define XML_LRM_TAG_RESOURCES
#define crm_err(fmt, args...)
#define XML_CIB_TAG_TICKET_STATE
#define set_config_flag(data_set, option, flag)
xmlXPathObjectPtr xpath_search(xmlNode *xml_top, const char *path)
char guint crm_parse_interval_spec(const char *input)
Parse milliseconds from a Pacemaker interval specification.
gboolean decode_transition_key(const char *key, char **uuid, int *transition_id, int *action_id, int *target_rc)
Parse a transition key into its constituent parts.
char * pcmk__epoch2str(const time_t *source, uint32_t flags)
void pe__set_next_role(pe_resource_t *rsc, enum rsc_role_e role, const char *why)
#define XML_ATTR_HAVE_WATCHDOG
#define XML_NODE_ATTR_RSC_DISCOVERY
gboolean unpack_nodes(xmlNode *xml_nodes, pe_working_set_t *data_set)
#define CRMD_ACTION_METADATA
#define XML_LRM_ATTR_INTERVAL_MS
#define XML_LRM_ATTR_CALLID
#define CRMD_ACTION_MIGRATE
#define XML_NVPAIR_ATTR_VALUE
void native_add_running(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set, gboolean failed)
#define pe__clear_resource_flags(resource, flags_to_clear)
#define XML_LRM_ATTR_OPSTATUS
pe_node_t * pe_find_node(const GList *node_list, const char *node_name)
Find a node by name in a list of nodes.
#define pe__set_working_set_flags(working_set, flags_to_set)
#define CRMD_JOINSTATE_PENDING
rsc_role_e
Possible roles that a resource can be in.
CRM_TRACE_INIT_DATA(pe_status)
Agent or dependency not available locally.
GHashTable * digest_cache
cache of calculated resource digests
#define pe_rsc_failure_ignored
void calculate_active_ops(const GList *sorted_op_list, int *start_index, int *stop_index)
#define XML_NODE_JOIN_STATE
pe_working_set_t * cluster
void destroy_ticket(gpointer data)
gboolean unpack_resources(const xmlNode *xml_resources, pe_working_set_t *data_set)
#define XML_CIB_TAG_STATUS
#define XML_CIB_TAG_OBJ_REF
const char * pcmk__readable_interval(guint interval_ms)
#define XML_NODE_IN_CLUSTER
#define SUB_XPATH_LRM_RESOURCE
gboolean crm_is_true(const char *s)
#define pe_flag_have_stonith_resource
void pe__unpack_dataset_nvpairs(const xmlNode *xml_obj, const char *set_name, const pe_rule_eval_data_t *rule_data, GHashTable *hash, const char *always_first, gboolean overwrite, pe_working_set_t *data_set)
#define CRM_ATTR_SITE_NAME
#define XML_CIB_TAG_GROUP
#define pe_flag_enable_unfencing
GList * find_operations(const char *rsc, const char *node, gboolean active_filter, pe_working_set_t *data_set)
#define XML_LRM_TAG_RSC_OP
#define pe_rsc_trace(rsc, fmt, args...)
Action cannot be attempted (e.g. shutdown)
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.
#define XML_LRM_ATTR_MIGRATE_SOURCE
pe_resource_t *(* find_rsc)(pe_resource_t *parent, const char *search, const pe_node_t *node, int flags)
int pe_get_failcount(const pe_node_t *node, pe_resource_t *rsc, time_t *last_failure, uint32_t flags, const xmlNode *xml_op)
pe_action_t * custom_action(pe_resource_t *rsc, char *key, const char *task, const pe_node_t *on_node, gboolean optional, gboolean foo, pe_working_set_t *data_set)
Create or update an action object.
void freeXpathObject(xmlXPathObjectPtr xpathObj)
op_digest_cache_t * rsc_action_digest_cmp(pe_resource_t *rsc, const xmlNode *xml_op, pe_node_t *node, pe_working_set_t *data_set)
bool pcmk_xe_is_probe(const xmlNode *xml_op)
#define pe__clear_working_set_flags(working_set, flags_to_clear)
#define XPATH_ENABLE_UNFENCING
#define pe_flag_start_failure_fatal
#define XML_CIB_TAG_TICKETS
Execution failed, may be retried.
#define crm_info(fmt, args...)
GHashTable * template_rsc_sets
char * clone_strip(const char *last_rsc_id)
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 pe_free_action(pe_action_t *action)
#define pe_flag_shutdown_lock
int pe__unpack_resource(xmlNode *xml_obj, pe_resource_t **rsc, pe_resource_t *parent, pe_working_set_t *data_set)
#define pe_rsc_info(rsc, fmt, args...)
GHashTable * allowed_nodes
#define pe_flag_startup_probes
#define CRMD_ACTION_STATUS
xmlNode * crm_next_same_xml(const xmlNode *sibling)
Get next instance of same XML tag.
#define pe_flag_stop_rsc_orphans