25 #define set_config_flag(data_set, option, flag) do { \
26 const char *tmp = pe_pref(data_set->config_hash, option); \
28 if(crm_is_true(tmp)) { \
29 set_bit(data_set->flags, flag); \
31 clear_bit(data_set->flags, flag); \
44 is_dangling_container_remote_node(
node_t *node)
79 "(otherwise would because %s): "
80 "its guest resource %s is unmanaged",
83 crm_warn(
"Guest node %s will be fenced "
84 "(by recovering its guest resource %s): %s",
96 }
else if (is_dangling_container_remote_node(node)) {
97 crm_info(
"Cleaning up dangling connection for guest node %s: "
98 "fencing was already done because %s, "
99 "and guest resource no longer exists",
108 "(otherwise would because %s): connection is unmanaged",
114 pe_can_fence(data_set, node)?
"will be fenced" :
"is unclean",
121 crm_trace(
"Cluster node %s %s because %s",
123 pe_can_fence(data_set, node)?
"would also be fenced" :
"also is unclean",
129 pe_can_fence(data_set, node)?
"will be fenced" :
"is unclean",
139 #define XPATH_UNFENCING_NVPAIR XML_CIB_TAG_NVPAIR \
140 "[(@" XML_NVPAIR_ATTR_NAME "='" XML_RSC_ATTR_PROVIDES "'" \
141 "or @" XML_NVPAIR_ATTR_NAME "='" XML_RSC_ATTR_REQUIRES "') " \
142 "and @" XML_NVPAIR_ATTR_VALUE "='unfencing']"
145 #define XPATH_ENABLE_UNFENCING \
146 "/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION "/" XML_CIB_TAG_RESOURCES \
147 "//" XML_TAG_META_SETS "/" XPATH_UNFENCING_NVPAIR \
148 "|/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION "/" XML_CIB_TAG_RSCCONFIG \
149 "/" XML_TAG_META_SETS "/" XPATH_UNFENCING_NVPAIR
152 void set_if_xpath(
unsigned long long flag,
const char *xpath,
155 xmlXPathObjectPtr result = NULL;
157 if (is_not_set(data_set->
flags, flag)) {
159 if (result && (numXpathResults(result) > 0)) {
169 const char *value = NULL;
170 GHashTable *config_hash = crm_str_table_new();
181 crm_info(
"Startup probes: disabled (dangerous)");
186 crm_notice(
"Watchdog will be used via SBD if fencing is required");
200 crm_debug(
"STONITH of failed nodes is %s",
206 "Support for stonith-action of 'poweroff' is deprecated "
207 "and will be removed in a future release (use 'off' instead)");
217 crm_debug(
"Stop all active resources: %s",
222 crm_debug(
"Cluster is symmetric" " - resources can run anywhere by default");
242 crm_notice(
"Resetting no-quorum-policy to 'stop': cluster has never had quorum");
246 crm_config_err(
"Resetting no-quorum-policy to 'stop': stonith is not configured");
256 crm_debug(
"On loss of quorum: Freeze resources");
259 crm_debug(
"On loss of quorum: Stop ALL resources");
262 crm_notice(
"On loss of quorum: Fence all remaining nodes");
274 crm_trace(
"Orphan resource actions are %s",
278 crm_trace(
"Stopped resources are removed from the status section: %s",
287 is_set(data_set->
flags,
294 crm_trace(
"Unseen nodes will be fenced");
303 crm_debug(
"Node scores: 'red' = %s, 'yellow' = %s, 'green' = %s",
315 destroy_digest_cache(gpointer ptr)
323 free(
data->digest_all_calc);
324 free(
data->digest_restart_calc);
325 free(
data->digest_secure_calc);
338 " - this is rarely intended",
uname);
341 new_node = calloc(1,
sizeof(
node_t));
342 if (new_node == NULL) {
347 new_node->
fixed = FALSE;
350 if (new_node->
details == NULL) {
385 destroy_digest_cache);
398 if (
data->name_check == NULL) {
400 for (xml_rsc = __xml_first_child(parent); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
401 const char *
id =
ID(xml_rsc);
404 g_hash_table_insert(
data->name_check, (
char *)
id, (
char *)
id);
407 if (g_hash_table_lookup(
data->name_check, remote_name)) {
412 crm_err(
"Invalid remote-node name, a resource called '%s' already exists.", remote_name);
423 xmlNode *attr_set = NULL;
424 xmlNode *attr = NULL;
426 const char *container_id =
ID(xml_obj);
427 const char *remote_name = NULL;
428 const char *remote_server = NULL;
429 const char *remote_port = NULL;
430 const char *connect_timeout =
"60s";
431 const char *remote_allow_migrate=NULL;
432 const char *container_managed = NULL;
434 for (attr_set = __xml_first_child(xml_obj); attr_set != NULL; attr_set = __xml_next_element(attr_set)) {
439 for (attr = __xml_first_child(attr_set); attr != NULL; attr = __xml_next_element(attr)) {
446 remote_server = value;
449 }
else if (
safe_str_eq(name,
"remote-connect-timeout")) {
450 connect_timeout = value;
451 }
else if (
safe_str_eq(name,
"remote-allow-migrate")) {
452 remote_allow_migrate=value;
454 container_managed = value;
459 if (remote_name == NULL) {
468 remote_allow_migrate, container_managed,
469 connect_timeout, remote_server, remote_port);
501 xmlNode *xml_obj = NULL;
503 const char *
id = NULL;
504 const char *
uname = NULL;
505 const char *
type = NULL;
506 const char *score = NULL;
508 for (xml_obj = __xml_first_child(xml_nodes); xml_obj != NULL; xml_obj = __xml_next_element(xml_obj)) {
524 if (new_node == NULL) {
534 handle_startup_fencing(data_set, new_node);
545 crm_info(
"Creating a fake local node");
556 const char *container_id = NULL;
561 for (; gIter != NULL; gIter = gIter->next) {
564 setup_container(child_rsc, data_set);
577 pe_rsc_trace(rsc,
"Resource %s's container is %s", rsc->
id, container_id);
579 pe_err(
"Resource %s: Unknown resource container (%s)", rsc->
id, container_id);
587 xmlNode *xml_obj = NULL;
590 for (xml_obj = __xml_first_child(xml_resources); xml_obj != NULL; xml_obj = __xml_next_element(xml_obj)) {
591 const char *new_node_id = NULL;
596 new_node_id =
ID(xml_obj);
600 crm_trace(
"Found baremetal remote node %s in container resource %s", new_node_id,
ID(xml_obj));
617 new_node_id = expand_remote_rsc_meta(xml_obj, xml_resources, data_set);
620 crm_trace(
"Found guest remote node %s in container resource %s", new_node_id,
ID(xml_obj));
627 xmlNode *xml_obj2 = NULL;
629 for (xml_obj2 = __xml_first_child(xml_obj); xml_obj2 != NULL; xml_obj2 = __xml_next_element(xml_obj2)) {
631 new_node_id = expand_remote_rsc_meta(xml_obj2, xml_resources, data_set);
634 crm_trace(
"Found guest remote node %s in container resource %s which is in group %s", new_node_id,
ID(xml_obj2),
ID(xml_obj));
656 node_t *remote_node = NULL;
677 handle_startup_fencing(data_set, remote_node);
682 strdup(
"container"));
687 destroy_tag(gpointer
data)
693 g_list_free_full(tag->
refs, free);
713 xmlNode *xml_obj = NULL;
720 for (xml_obj = __xml_first_child(xml_resources); xml_obj != NULL; xml_obj = __xml_next_element(xml_obj)) {
724 const char *template_id =
ID(xml_obj);
727 template_id, NULL, NULL) == FALSE) {
734 crm_trace(
"Beginning unpack... <%s id=%s... >", crm_element_name(xml_obj),
ID(xml_obj));
742 if (new_rsc != NULL && new_rsc->
fns != NULL) {
748 for (gIter = data_set->
resources; gIter != NULL; gIter = gIter->next) {
751 setup_container(rsc, data_set);
752 link_rsc2remotenode(data_set, rsc);
762 crm_config_err(
"Resource start-up disabled since no STONITH resources have been defined");
763 crm_config_err(
"Either configure some or disable STONITH with the stonith-enabled option");
764 crm_config_err(
"NOTE: Clusters with shared data need STONITH to ensure data integrity");
773 xmlNode *xml_tag = NULL;
778 for (xml_tag = __xml_first_child(xml_tags); xml_tag != NULL; xml_tag = __xml_next_element(xml_tag)) {
779 xmlNode *xml_obj_ref = NULL;
780 const char *tag_id =
ID(xml_tag);
786 if (tag_id == NULL) {
792 for (xml_obj_ref = __xml_first_child(xml_tag); xml_obj_ref != NULL; xml_obj_ref = __xml_next_element(xml_obj_ref)) {
793 const char *obj_ref =
ID(xml_obj_ref);
799 if (obj_ref == NULL) {
800 crm_config_err(
"Failed unpacking %s for tag %s: %s should be specified",
801 crm_element_name(xml_obj_ref), tag_id,
XML_ATTR_ID);
819 const char *ticket_id = NULL;
820 const char *granted = NULL;
821 const char *last_granted = NULL;
822 const char *standby = NULL;
823 xmlAttrPtr xIter = NULL;
827 ticket_id =
ID(xml_ticket);
828 if (ticket_id == NULL || strlen(ticket_id) == 0) {
832 crm_trace(
"Processing ticket state for %s", ticket_id);
834 ticket = g_hash_table_lookup(data_set->
tickets, ticket_id);
835 if (ticket == NULL) {
837 if (ticket == NULL) {
842 for (xIter = xml_ticket->properties; xIter; xIter = xIter->next) {
843 const char *prop_name = (
const char *)xIter->name;
849 g_hash_table_replace(ticket->
state, strdup(prop_name), strdup(prop_value));
852 granted = g_hash_table_lookup(ticket->
state,
"granted");
858 crm_info(
"We do not have ticket '%s'", ticket->
id);
861 last_granted = g_hash_table_lookup(ticket->
state,
"last-granted");
866 standby = g_hash_table_lookup(ticket->
state,
"standby");
870 crm_info(
"Granted ticket '%s' is in standby-mode", ticket->
id);
876 crm_trace(
"Done with ticket state for %s", ticket_id);
884 xmlNode *xml_obj = NULL;
886 for (xml_obj = __xml_first_child(xml_tickets); xml_obj != NULL; xml_obj = __xml_next_element(xml_obj)) {
890 unpack_ticket_state(xml_obj, data_set);
899 const char *resource_discovery_enabled = NULL;
900 xmlNode *attrs = NULL;
902 const char *shutdown = NULL;
908 if ((this_node == NULL) || (
is_remote_node(this_node) == FALSE)) {
945 if (resource_discovery_enabled && !
crm_is_true(resource_discovery_enabled)) {
947 crm_warn(
"ignoring %s attribute on baremetal remote node %s, disabling resource discovery requires stonith to be enabled.",
963 bool changed =
false;
964 xmlNode *lrm_rsc = NULL;
966 for (xmlNode *state = __xml_first_child(status); state != NULL; state = __xml_next_element(state)) {
967 const char *
id = NULL;
968 const char *
uname = NULL;
970 bool process = FALSE;
980 if (this_node == NULL) {
985 crm_info(
"Node %s is already processed",
id);
999 }
else if(rsc == NULL) {
1019 determine_remote_online_status(data_set, this_node);
1020 unpack_handle_remote_attrs(this_node, state, data_set);
1032 crm_trace(
"Processing lrm resource entries on %shealthy%s node: %s",
1052 const char *
id = NULL;
1053 const char *
uname = NULL;
1055 xmlNode *state = NULL;
1056 node_t *this_node = NULL;
1060 if (data_set->
tickets == NULL) {
1065 for (state = __xml_first_child(status); state != NULL; state = __xml_next_element(state)) {
1067 unpack_tickets_state((xmlNode *) state, data_set);
1070 xmlNode *attrs = NULL;
1071 const char *resource_discovery_enabled = NULL;
1077 if (
uname == NULL) {
1081 }
else if (this_node == NULL) {
1116 if (resource_discovery_enabled && !
crm_is_true(resource_discovery_enabled)) {
1117 crm_warn(
"ignoring %s attribute on node %s, disabling resource discovery is not allowed on cluster nodes",
1130 pe_fence_node(data_set, this_node,
"cluster does not have quorum");
1136 while(unpack_node_loop(status, FALSE, data_set)) {
1147 for (GList *item = data_set->
stop_needed; item; item = item->next) {
1149 pe_node_t *node = pe__current_node(container);
1159 for (
GListPtr gIter = data_set->
nodes; gIter != NULL; gIter = gIter->next) {
1160 node_t *this_node = gIter->data;
1162 if (this_node == NULL) {
1169 determine_remote_online_status(data_set, this_node);
1176 determine_online_status_no_fencing(
pe_working_set_t * data_set, xmlNode * node_state,
1179 gboolean online = FALSE;
1192 crm_debug(
"Node is not ready to run resources: %s", join);
1197 crm_trace(
"\tis_peer=%s, join=%s, expected=%s",
1202 pe_fence_node(data_set, this_node,
"peer is unexpectedly down");
1203 crm_info(
"\tin_cluster=%s, is_peer=%s, join=%s, expected=%s",
1210 determine_online_status_fencing(
pe_working_set_t * data_set, xmlNode * node_state,
1213 gboolean online = FALSE;
1214 gboolean do_terminate = FALSE;
1215 bool crmd_online = FALSE;
1230 do_terminate = TRUE;
1232 }
else if (terminate != NULL && strlen(terminate) > 0) {
1234 char t = terminate[0];
1236 if (t !=
'0' && isdigit(t)) {
1237 do_terminate = TRUE;
1241 crm_trace(
"%s: in_cluster=%s, is_peer=%s, join=%s, expected=%s, term=%d",
1247 if (exp_state == NULL) {
1255 online = crmd_online;
1257 }
else if (in_cluster == NULL) {
1258 pe_fence_node(data_set, this_node,
"peer has not been seen by the cluster");
1261 pe_fence_node(data_set, this_node,
"peer failed the pacemaker membership criteria");
1275 &&
crm_is_true(in_cluster) == FALSE && !crmd_online) {
1280 pe_fence_node(data_set, this_node,
"peer is no longer part of the cluster");
1282 }
else if (!crmd_online) {
1283 pe_fence_node(data_set, this_node,
"peer process is no longer available");
1286 }
else if (do_terminate) {
1287 pe_fence_node(data_set, this_node,
"termination was requested");
1299 pe_fence_node(data_set, this_node,
"peer was in an unknown state");
1300 crm_warn(
"%s: in-cluster=%s, is-peer=%s, join=%s, expected=%s, term=%d, shutdown=%d",
1321 goto remote_online_done;
1326 if (container && (g_list_length(rsc->
running_on) == 1)) {
1332 crm_trace(
"%s node %s presumed ONLINE because connection resource is started",
1333 (container?
"Guest" :
"Remote"), this_node->
details->
id);
1339 crm_trace(
"%s node %s shutting down because connection resource is stopping",
1340 (container?
"Guest" :
"Remote"), this_node->
details->
id);
1346 crm_trace(
"Guest node %s UNCLEAN because guest resource failed",
1352 crm_trace(
"%s node %s OFFLINE because connection resource failed",
1353 (container?
"Guest" :
"Remote"), this_node->
details->
id);
1359 crm_trace(
"%s node %s OFFLINE because its resource is stopped",
1360 (container?
"Guest" :
"Remote"), this_node->
details->
id);
1364 }
else if (
host && (
host->details->online == FALSE)
1365 &&
host->details->unclean) {
1366 crm_trace(
"Guest node %s UNCLEAN because host is unclean",
1381 gboolean online = FALSE;
1382 const char *shutdown = NULL;
1385 if (this_node == NULL) {
1409 online = determine_online_status_no_fencing(data_set, node_state, this_node);
1412 online = determine_online_status_fencing(data_set, node_state, this_node);
1420 this_node->
fixed = TRUE;
1426 this_node->
fixed = TRUE;
1461 if (!crm_strlen_zero(
id)) {
1462 const char *end =
id + strlen(
id) - 1;
1464 for (
const char *s = end; s >
id; --s) {
1478 return (s == end)? s : (s - 1);
1502 char *basename = NULL;
1505 basename =
strndup(last_rsc_id, end - last_rsc_id + 1);
1524 size_t base_name_len = end - last_rsc_id + 1;
1528 zero = calloc(base_name_len + 3,
sizeof(
char));
1530 memcpy(zero, last_rsc_id, base_name_len);
1531 zero[base_name_len] =
':';
1532 zero[base_name_len + 1] =
'0';
1537 create_fake_resource(
const char *rsc_id, xmlNode * rsc_entry,
pe_working_set_t * data_set)
1553 crm_debug(
"Detected orphaned remote node %s", rsc_id);
1558 link_rsc2remotenode(data_set, rsc);
1561 crm_trace(
"Setting node %s as shutting down due to orphaned connection resource", rsc_id);
1568 crm_trace(
"Detected orphaned container filler %s", rsc_id);
1581 create_anonymous_orphan(
pe_resource_t *parent,
const char *rsc_id,
1589 pe_rsc_debug(parent,
"Created orphan %s for %s: %s on %s",
1615 gboolean skip_inactive = FALSE;
1623 for (rIter = parent->
children; rsc == NULL && rIter; rIter = rIter->next) {
1668 crm_notice(
"Active (now-)anonymous clone %s has "
1669 "multiple (orphan) instance histories on %s",
1671 skip_inactive = TRUE;
1678 g_list_free(locations);
1682 if (!skip_inactive && !inactive_instance
1685 inactive_instance = parent->
fns->
find_rsc(child, rsc_id, NULL,
1691 if (inactive_instance && inactive_instance->
pending_node
1693 inactive_instance = NULL;
1699 if ((rsc == NULL) && !skip_inactive && (inactive_instance != NULL)) {
1700 pe_rsc_trace(parent,
"Resource %s, empty slot", inactive_instance->
id);
1701 rsc = inactive_instance;
1725 rsc = create_anonymous_orphan(parent, rsc_id, node, data_set);
1733 xmlNode * rsc_entry)
1752 crm_trace(
"%s found as %s (%s)", rsc_id, clone0_id, parent->
id);
1754 crm_trace(
"%s is not known as %s either (orphan)",
1760 crm_trace(
"Resource history for %s is orphaned because it is no longer primitive",
1768 if (pe_rsc_is_anon_clone(parent)) {
1770 if (pe_rsc_is_bundled(parent)) {
1775 rsc = find_anonymous_clone(data_set, node, parent, base);
1786 pe_rsc_debug(rsc,
"Internally renamed %s on %s to %s%s",
1800 rsc = create_fake_resource(rsc_id, rsc_entry, data_set);
1820 char *reason = NULL;
1823 pe_rsc_trace(rsc,
"Resource %s is %s on %s: on_fail=%s",
1851 gboolean should_fence = FALSE;
1862 should_fence = TRUE;
1875 " revoked if remote connection can "
1876 "be re-established elsewhere)",
1879 should_fence = TRUE;
1883 if (reason == NULL) {
1946 if (rsc->
container && pe_rsc_is_bundled(rsc)) {
1975 "remote connection is unrecoverable");
2010 " %s must be stopped manually on %s",
2033 for (; gIter != NULL; gIter = gIter->next) {
2039 g_list_free(possible_matches);
2047 int start_index,
int stop_index,
2051 const char *task = NULL;
2052 const char *status = NULL;
2056 pe_rsc_trace(rsc,
"%s: Start index %d, stop index = %d", rsc->
id, start_index, stop_index);
2058 for (; gIter != NULL; gIter = gIter->next) {
2059 xmlNode *rsc_op = (xmlNode *) gIter->data;
2061 guint interval_ms = 0;
2063 const char *
id =
ID(rsc_op);
2064 const char *interval_ms_s = NULL;
2073 }
else if (start_index < stop_index && counter <= stop_index) {
2077 }
else if (counter < start_index) {
2084 if (interval_ms == 0) {
2106 int implied_monitor_start = -1;
2107 int implied_clone_start = -1;
2108 const char *task = NULL;
2109 const char *status = NULL;
2115 for (; gIter != NULL; gIter = gIter->next) {
2116 xmlNode *rsc_op = (xmlNode *) gIter->data;
2125 *stop_index = counter;
2128 *start_index = counter;
2134 implied_monitor_start = counter;
2137 implied_clone_start = counter;
2141 if (*start_index == -1) {
2142 if (implied_clone_start != -1) {
2143 *start_index = implied_clone_start;
2144 }
else if (implied_monitor_start != -1) {
2145 *start_index = implied_monitor_start;
2154 int stop_index = -1;
2155 int start_index = -1;
2158 const char *task = NULL;
2165 xmlNode *migrate_op = NULL;
2166 xmlNode *rsc_op = NULL;
2167 xmlNode *last_failure = NULL;
2173 crm_element_name(rsc_entry), rsc_id, node->
details->
uname);
2177 sorted_op_list = NULL;
2179 for (rsc_op = __xml_first_child(rsc_entry); rsc_op != NULL; rsc_op = __xml_next_element(rsc_op)) {
2181 op_list = g_list_prepend(op_list, rsc_op);
2185 if (op_list == NULL) {
2191 rsc = unpack_find_resource(data_set, node, rsc_id, rsc_entry);
2193 rsc = process_orphan_resource(rsc_entry, node, data_set);
2198 saved_role = rsc->
role;
2203 for (gIter = sorted_op_list; gIter != NULL; gIter = gIter->next) {
2204 xmlNode *rsc_op = (xmlNode *) gIter->data;
2208 migrate_op = rsc_op;
2211 unpack_rsc_op(rsc, node, rsc_op, &last_failure, &on_fail, data_set);
2216 process_recurring(node, rsc, start_index, stop_index, sorted_op_list, data_set);
2219 g_list_free(sorted_op_list);
2221 process_rsc_state(rsc, node, on_fail, migrate_op, data_set);
2225 pe_rsc_debug(rsc,
"%s: Overwriting calculated next role %s"
2226 " with requested next role %s",
2231 pe_rsc_info(rsc,
"%s: Not overwriting calculated next role %s"
2232 " with requested next role %s",
2237 if (saved_role > rsc->
role) {
2238 rsc->
role = saved_role;
2245 handle_orphaned_container_fillers(xmlNode * lrm_rsc_list,
pe_working_set_t * data_set)
2247 xmlNode *rsc_entry = NULL;
2248 for (rsc_entry = __xml_first_child(lrm_rsc_list); rsc_entry != NULL;
2249 rsc_entry = __xml_next_element(rsc_entry)) {
2254 const char *container_id;
2262 if (container_id == NULL || rsc_id == NULL) {
2267 if (container == NULL) {
2278 pe_rsc_trace(rsc,
"Mapped container of orphaned resource %s to %s",
2279 rsc->
id, container_id);
2288 xmlNode *rsc_entry = NULL;
2289 gboolean found_orphaned_container_filler = FALSE;
2295 for (rsc_entry = __xml_first_child(lrm_rsc_list); rsc_entry != NULL;
2296 rsc_entry = __xml_next_element(rsc_entry)) {
2299 resource_t *rsc = unpack_lrm_rsc_state(node, rsc_entry, data_set);
2304 found_orphaned_container_filler = TRUE;
2312 if (found_orphaned_container_filler) {
2313 handle_orphaned_container_fillers(lrm_rsc_list, data_set);
2331 set_node_score(gpointer key, gpointer value, gpointer user_data)
2334 int *score = user_data;
2339 #define STATUS_PATH_MAX 1024
2341 find_lrm_op(
const char *resource,
const char *op,
const char *node,
const char *source,
2347 offset += snprintf(xpath + offset,
STATUS_PATH_MAX - offset,
"//node_state[@uname='%s']", node);
2386 if (stop_id > task_id) {
2413 int from_status = 0;
2414 const char *migrate_source = NULL;
2415 const char *migrate_target = NULL;
2418 xmlNode *migrate_from = NULL;
2420 if (stop_happened_after(rsc, node, xml_op, data_set)) {
2435 migrate_source, data_set);
2439 pe_rsc_trace(rsc,
"%s op on %s exited with status=%d, rc=%d",
2440 ID(migrate_from), migrate_target, from_status, from_rc);
2449 pe_rsc_trace(rsc,
"Detected dangling migration op: %s on %s",
ID(xml_op),
2456 pe_rsc_trace(rsc,
"Marking active on %s %p %d", migrate_target, target,
2463 pe_rsc_trace(rsc,
"Marking active on %s %p %d", migrate_target, target,
2499 xmlNode *migrate_op =
2513 if (stop_op == NULL || stop_id < migrate_id) {
2529 xmlNode *migrate_op =
2543 if (stop_op == NULL || stop_id < migrate_id) {
2546 pe_rsc_trace(rsc,
"Stop: %p %d, Migrated: %p %d", stop_op, stop_id, migrate_op,
2552 }
else if (migrate_op == NULL) {
2562 xmlNode *xIter = NULL;
2569 for (xIter = data_set->
failed->children; xIter; xIter = xIter->next) {
2585 static const char *get_op_key(xmlNode *xml_op)
2595 unpack_rsc_op_failure(
resource_t * rsc,
node_t * node,
int rc, xmlNode * xml_op, xmlNode ** last_failure,
2598 guint interval_ms = 0;
2599 bool is_probe = FALSE;
2602 const char *key = get_op_key(xml_op);
2607 *last_failure = xml_op;
2616 crm_warn(
"Processing failed %s of %s on %s: %s " CRM_XS " rc=%d",
2618 services_ocf_exitcode_str(rc), rc);
2627 crm_notice(
"If it is not possible for %s to run on %s, see "
2628 "the resource-discovery option for location constraints",
2632 record_failed_op(xml_op, node, rsc, data_set);
2635 crm_trace(
"Processing failed op %s for %s on %s: %s (%d)",
2636 task, rsc->
id, node->
details->
uname, services_ocf_exitcode_str(rc),
2640 action =
custom_action(rsc, strdup(key), task, NULL, TRUE, FALSE, data_set);
2654 unpack_rsc_migration_failure(rsc, node, xml_op, data_set);
2688 pe_rsc_trace(rsc,
"Resource %s: role=%s, unclean=%s, on_fail=%s, fail_role=%s",
2705 if (pe_rsc_is_clone(parent)
2713 crm_warn(
"Making sure %s doesn't come up again", fail_rsc->
id);
2719 g_hash_table_foreach(fail_rsc->
allowed_nodes, set_node_score, &score);
2726 determine_op_status(
2729 guint interval_ms = 0;
2732 const char *key = get_op_key(xml_op);
2735 bool is_probe = FALSE;
2743 if (target_rc >= 0 && target_rc != rc) {
2745 pe_rsc_debug(rsc,
"%s on %s returned '%s' (%d) instead of the expected value: '%s' (%d)",
2747 services_ocf_exitcode_str(rc), rc,
2748 services_ocf_exitcode_str(target_rc), target_rc);
2756 if (is_probe && target_rc == 7) {
2758 pe_rsc_info(rsc,
"Operation %s found resource %s active on %s",
2780 pe_rsc_info(rsc,
"Operation %s found resource %s active in master mode on %s",
2783 }
else if (target_rc == rc) {
2786 }
else if (target_rc >= 0) {
2813 pe_proc_err(
"No further recovery can be attempted for %s: %s action failed with '%s' (%d)",
2814 rsc->
id, task, services_ocf_exitcode_str(rc), rc);
2823 crm_info(
"Treating %s (rc=%d) on %s as an ERROR",
2834 bool expired = FALSE;
2835 time_t last_failure = 0;
2836 guint interval_ms = 0;
2838 const char *key = get_op_key(xml_op);
2840 const char *clear_reason = NULL;
2846 if ((interval_ms != 0) &&
safe_str_eq(task,
"monitor")) {
2862 if (strstr(
ID(xml_op),
"last_failure")) {
2863 crm_info(
"Waiting to clear monitor failure for remote node %s until fencing has occurred", rsc->
id);
2867 failure_timeout = 0;
2872 if (failure_timeout > 0) {
2878 if (now > (last_run + failure_timeout)) {
2891 xml_op, data_set) == 0) {
2893 clear_reason =
"it expired";
2900 && strstr(
ID(xml_op),
"last_failure")) {
2902 clear_reason =
"reconnect interval is set";
2905 }
else if (strstr(
ID(xml_op),
"last_failure") &&
2906 ((strcmp(task,
"start") == 0) || (strcmp(task,
"monitor") == 0))) {
2920 switch (digest_data->
rc) {
2922 crm_trace(
"Resource %s history entry %s on %s has no digest to compare",
2928 clear_reason =
"resource parameters have changed";
2934 if (clear_reason != NULL) {
2956 crm_info(
"Clearing %s failure will wait until any scheduled "
2957 "fencing of %s completes", task, rsc->
id);
2983 char *dummy_string = NULL;
3008 update_resource_state(
resource_t * rsc,
node_t * node, xmlNode * xml_op,
const char * task,
int rc,
3011 gboolean clear_past_failure = FALSE;
3017 clear_past_failure = TRUE;
3024 const char *op_key = get_op_key(xml_op);
3025 const char *last_failure_key = get_op_key(last_failure);
3028 clear_past_failure = TRUE;
3038 clear_past_failure = TRUE;
3042 clear_past_failure = TRUE;
3046 clear_past_failure = TRUE;
3054 clear_past_failure = TRUE;
3057 unpack_rsc_migration(rsc, node, xml_op, data_set);
3065 if (clear_past_failure) {
3071 pe_rsc_trace(rsc,
"%s.%s is not cleared by a completed stop",
3105 const char *key = NULL;
3106 const char *task = NULL;
3107 const char *task_key = NULL;
3112 guint interval_ms = 0;
3114 gboolean expired = FALSE;
3120 CRM_CHECK(xml_op != NULL,
return FALSE);
3122 task_key = get_op_key(xml_op);
3146 pe_rsc_trace(rsc,
"Unpacking task %s/%s (call_id=%d, status=%d, rc=%d) on %s (role=%s)",
3150 pe_rsc_trace(rsc,
"Node %s (where %s is running) is unclean."
3151 " Further action depends on the value of the stop's on-fail attribute",
3156 expired = check_operation_expiry(rsc, node, rc, xml_op, data_set);
3166 record_failed_op(xml_op, node, rsc, data_set);
3175 record_failed_op(xml_op, node, rsc, data_set);
3179 if (expired && target_rc != rc) {
3182 pe_rsc_debug(rsc,
"Expired operation '%s' on %s returned '%s' (%d) instead of the expected value: '%s' (%d)",
3184 services_ocf_exitcode_str(rc), rc,
3185 services_ocf_exitcode_str(target_rc), target_rc);
3187 if (interval_ms == 0) {
3188 crm_notice(
"Ignoring expired calculated failure %s (rc=%d, magic=%s) on %s",
3193 crm_notice(
"Re-initiated expired calculated failure %s (rc=%d, magic=%s) on %s",
3202 status = determine_op_status(rsc, rc, target_rc, node, xml_op, on_fail, data_set);
3209 pe_err(
"Don't know what to do for cancelled ops yet");
3248 update_resource_state(rsc, node, xml_op, task, rc, *last_failure, on_fail, data_set);
3252 failure_strategy = get_action_on_fail(rsc, task_key, task, data_set);
3254 crm_warn(
"Cannot ignore failed %s (status=%d, rc=%d) on %s: "
3255 "Resource agent doesn't exist",
3261 unpack_rsc_op_failure(rsc, node, rc, xml_op, last_failure, on_fail, data_set);
3270 failure_strategy = get_action_on_fail(rsc, task_key, task, data_set);
3275 crm_warn(
"Pretending the failure of %s (rc=%d) on %s succeeded",
3278 update_resource_state(rsc, node, xml_op, task, target_rc, *last_failure, on_fail, data_set);
3282 record_failed_op(xml_op, node, rsc, data_set);
3285 *on_fail = failure_strategy;
3289 unpack_rsc_op_failure(rsc, node, rc, xml_op, last_failure, on_fail, data_set);
3293 "Preventing %s from re-starting on %s: operation %s failed '%s' (%d)",
3295 task, services_ocf_exitcode_str(rc), rc);
3300 crm_err(
"Preventing %s from re-starting anywhere: operation %s failed '%s' (%d)",
3301 parent->
id, task, services_ocf_exitcode_str(rc), rc);
3317 const char *cluster_name = NULL;
3334 cluster_name = g_hash_table_lookup(data_set->
config_hash,
"cluster-name");
3337 strdup(cluster_name));
3351 }
else if (cluster_name) {
3355 strdup(cluster_name));
3362 extract_operations(
const char *node,
const char *rsc, xmlNode * rsc_entry, gboolean active_filter)
3365 int stop_index = -1;
3366 int start_index = -1;
3368 xmlNode *rsc_op = NULL;
3376 sorted_op_list = NULL;
3378 for (rsc_op = __xml_first_child(rsc_entry); rsc_op != NULL; rsc_op = __xml_next_element(rsc_op)) {
3382 op_list = g_list_prepend(op_list, rsc_op);
3386 if (op_list == NULL) {
3394 if (active_filter == FALSE) {
3395 return sorted_op_list;
3402 for (gIter = sorted_op_list; gIter != NULL; gIter = gIter->next) {
3403 xmlNode *rsc_op = (xmlNode *) gIter->data;
3407 if (start_index < stop_index) {
3408 crm_trace(
"Skipping %s: not active",
ID(rsc_entry));
3411 }
else if (counter < start_index) {
3415 op_list = g_list_append(op_list, rsc_op);
3418 g_list_free(sorted_op_list);
3429 xmlNode *tmp = NULL;
3432 node_t *this_node = NULL;
3434 xmlNode *node_state = NULL;
3436 for (node_state = __xml_first_child(status); node_state != NULL;
3437 node_state = __xml_next_element(node_state)) {
3447 if(this_node == NULL) {
3452 determine_remote_online_status(data_set, this_node);
3463 xmlNode *lrm_rsc = NULL;
3468 for (lrm_rsc = __xml_first_child(tmp); lrm_rsc != NULL;
3469 lrm_rsc = __xml_next_element(lrm_rsc)) {
3478 intermediate = extract_operations(
uname, rsc_id, lrm_rsc, active_filter);
3479 output = g_list_concat(output, intermediate);