33 extern xmlNode *
get_object_root(
const char *object_type, xmlNode * the_root);
34 void print_str_str(gpointer key, gpointer value, gpointer user_data);
38 static xmlNode *find_rsc_op_entry_helper(
resource_t * rsc,
const char *key,
39 gboolean include_disabled);
41 #if ENABLE_VERSIONED_ATTRS
42 pe_rsc_action_details_t *
45 pe_rsc_action_details_t *details;
50 action->
action_details = calloc(1,
sizeof(pe_rsc_action_details_t));
55 if (details->versioned_parameters == NULL) {
59 if (details->versioned_meta == NULL) {
68 pe_rsc_action_details_t *details;
76 if (details->versioned_parameters) {
77 free_xml(details->versioned_parameters);
79 if (details->versioned_meta) {
114 }
else if(node == NULL) {
131 CRM_CHECK(this_node != NULL,
return NULL);
133 new_node = calloc(1,
sizeof(
node_t));
150 GHashTable *result = hash;
151 node_t *other_node = NULL;
157 g_hash_table_iter_init(&iter, hash);
158 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
161 if (other_node == NULL) {
163 }
else if (merge_scores) {
168 for (; gIter != NULL; gIter = gIter->next) {
171 other_node = pe_hash_table_lookup(result, node->
details->
id);
173 if (other_node == NULL) {
177 g_hash_table_insert(result, (gpointer) new_node->
details->
id, new_node);
188 for (; gIter != NULL; gIter = gIter->next) {
192 g_hash_table_insert(result, (gpointer) n->details->id, n);
204 for (; gIter != NULL; gIter = gIter->next) {
208 if (filter && this_node->
weight < 0) {
216 if (new_node != NULL) {
217 result = g_list_prepend(result, new_node);
235 resource_t * rsc,
const char *comment, GHashTable * nodes)
237 GHashTable *hash = nodes;
252 int len =
sizeof(score);
255 GListPtr list = g_hash_table_get_values(hash);
260 for (; gIter != NULL; gIter = gIter->next) {
266 printf(
"%s: %s allocation score on %s: %s\n",
269 printf(
"%s: %s = %s\n", comment, node->
details->
uname, score);
277 int len =
sizeof(score);
278 g_hash_table_iter_init(&iter, hash);
279 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
285 "%s: %s allocation score on %s: %s", comment, rsc->
id,
298 for (; gIter != NULL; gIter = gIter->next) {
307 append_dump_text(gpointer key, gpointer value, gpointer user_data)
309 char **dump_text = user_data;
311 char *new_text = NULL;
313 len = strlen(*dump_text) + strlen(
" ") + strlen(key) + strlen(
"=") + strlen(value) + 1;
314 new_text = calloc(1, len);
315 sprintf(new_text,
"%s %s=%s", *dump_text, (
char *)key, (
char *)value);
318 *dump_text = new_text;
325 char *dump_text = NULL;
327 len = strlen(comment) + strlen(
": ") + strlen(node->
details->
uname) + strlen(
" capacity:") + 1;
328 dump_text = calloc(1, len);
329 sprintf(dump_text,
"%s: %s capacity:", comment, node->
details->
uname);
334 fprintf(stdout,
"%s\n", dump_text);
346 char *dump_text = NULL;
348 len = strlen(comment) + strlen(
": ") + strlen(rsc->
id) + strlen(
" utilization on ")
350 dump_text = calloc(1, len);
351 sprintf(dump_text,
"%s: %s utilization on %s:", comment, rsc->
id, node->
details->
uname);
353 g_hash_table_foreach(rsc->
utilization, append_dump_text, &dump_text);
356 fprintf(stdout,
"%s\n", dump_text);
370 if (a == NULL && b == NULL) {
397 if (a == NULL && b == NULL) {
420 node_t * on_node, gboolean optional, gboolean save_action,
427 CRM_CHECK(task != NULL, free(key);
return NULL);
429 if (save_action && rsc != NULL) {
431 }
else if(save_action) {
433 action = g_hash_table_lookup(data_set->
singletons, key);
444 if (possible_matches != NULL) {
445 if (g_list_length(possible_matches) > 1) {
446 pe_warn(
"Action %s for %s on %s exists %d times",
447 task, rsc ? rsc->
id :
"<NULL>",
448 on_node ? on_node->
details->
uname :
"<NULL>", g_list_length(possible_matches));
451 action = g_list_nth_data(possible_matches, 0);
452 pe_rsc_trace(rsc,
"Found existing action (%d) %s for %s on %s",
453 action->
id, task, rsc ? rsc->
id :
"<NULL>",
455 g_list_free(possible_matches);
458 if (action == NULL) {
460 pe_rsc_trace(rsc,
"Creating%s action %d: %s for %s on %s %d",
461 optional ?
"" :
" mandatory", data_set->
action_id, key,
462 rsc ? rsc->
id :
"<NULL>", on_node ? on_node->
details->
uname :
"<NULL>", optional);
465 action = calloc(1,
sizeof(
action_t));
473 action->
task = strdup(task);
477 action->
uuid = strdup(key);
499 action->
extra = crm_str_table_new();
500 action->
meta = crm_str_table_new();
510 action->
op_entry = find_rsc_op_entry_helper(rsc, key, TRUE);
524 if (optional == FALSE) {
534 warn_level = LOG_WARNING;
542 action->
extra, NULL, FALSE, data_set->
now);
548 }
else if (action->
node == NULL) {
562 do_crm_log(warn_level,
"Action %s on %s is unrunnable (offline)",
565 && save_action && a_task ==
stop_rsc
572 do_crm_log(warn_level,
"Action %s on %s is unrunnable (pending)",
586 action->runnable = TRUE;
630 unpack_operation_on_fail(
action_t * action)
640 xmlNode *operation = NULL;
641 const char *name = NULL;
642 const char *role = NULL;
643 const char *on_fail = NULL;
644 const char *interval = NULL;
645 const char *enabled = NULL;
649 for (operation = __xml_first_child(action->
rsc->
ops_xml);
650 operation && !value; operation = __xml_next_element(operation)) {
652 if (!
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
678 find_min_interval_mon(
resource_t * rsc, gboolean include_disabled)
681 int min_interval = -1;
682 const char *name = NULL;
683 const char *value = NULL;
684 const char *interval = NULL;
686 xmlNode *operation = NULL;
688 for (operation = __xml_first_child(rsc->
ops_xml); operation != NULL;
689 operation = __xml_next_element(operation)) {
691 if (
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
695 if (!include_disabled && value &&
crm_is_true(value) == FALSE) {
708 if (min_interval < 0 || number < min_interval) {
709 min_interval = number;
719 unpack_start_delay(
const char *value, GHashTable *meta)
726 if (start_delay < 0) {
739 unpack_interval_origin(
const char *value, GHashTable *meta, xmlNode *xml_obj,
744 if (interval > 0 && value) {
750 long long delay_s = 0;
751 int interval_s = (interval / 1000);
753 crm_trace(
"Origin: %s, interval: %d", value, interval_s);
780 start_delay = delay_s * 1000;
783 crm_info(
"Calculated a start delay of %llds for %s", delay_s,
ID(xml_obj));
793 }
else if (!origin && xml_obj) {
803 unpack_timeout(
const char *value,
action_t *action, xmlNode *xml_obj,
804 unsigned long long interval, GHashTable *config_hash)
808 if (value == NULL && xml_obj == NULL && action &&
811 xmlNode *min_interval_mon = find_min_interval_mon(action->
rsc, FALSE);
813 if (min_interval_mon) {
816 "\t%s uses the timeout value '%s' from the minimum interval monitor",
817 action->
uuid, value);
821 if (value == NULL && config_hash) {
822 value =
pe_pref(config_hash,
"default-action-timeout");
825 "Support for 'default-action-timeout' cluster property"
826 " is deprecated and will be removed in a future release"
827 " (use 'timeout' in op_defaults instead)");
847 xmlNode *child = NULL;
848 const char *timeout = NULL;
860 GHashTable *action_meta = crm_str_table_new();
862 NULL, action_meta, NULL, FALSE, data_set->
now);
870 if (timeout == NULL) {
875 if (timeout_ms < 0) {
882 #if ENABLE_VERSIONED_ATTRS
884 unpack_versioned_meta(xmlNode *versioned_meta, xmlNode *xml_obj,
unsigned long long interval,
crm_time_t *now)
886 xmlNode *attrs = NULL;
887 xmlNode *attr = NULL;
889 for (attrs = __xml_first_child(versioned_meta); attrs != NULL; attrs = __xml_next_element(attrs)) {
890 for (attr = __xml_first_child(attrs); attr != NULL; attr = __xml_next_element(attr)) {
895 int start_delay = unpack_start_delay(value, NULL);
899 int start_delay = unpack_interval_origin(value, NULL, xml_obj, interval, now);
904 int timeout = unpack_timeout(value, NULL, NULL, 0, NULL);
917 unsigned long long interval = 0;
919 char *value_ms = NULL;
920 const char *value = NULL;
921 const char *field = NULL;
922 #if ENABLE_VERSIONED_ATTRS
923 pe_rsc_action_details_t *rsc_details = NULL;
929 action->
meta, NULL, FALSE, data_set->
now);
932 xmlAttrPtr xIter = NULL;
934 for (xIter = xml_obj->properties; xIter; xIter = xIter->next) {
935 const char *prop_name = (
const char *)xIter->name;
938 g_hash_table_replace(action->
meta, strdup(prop_name), strdup(prop_value));
943 NULL, action->
meta, NULL, FALSE, data_set->
now);
946 NULL, action->
meta, NULL, FALSE, data_set->
now);
948 #if ENABLE_VERSIONED_ATTRS
949 rsc_details = pe_rsc_action_details(action);
951 rsc_details->versioned_parameters, data_set->
now);
953 rsc_details->versioned_meta, data_set->
now);
956 g_hash_table_remove(action->
meta,
"id");
959 value = g_hash_table_lookup(action->
meta, field);
964 g_hash_table_replace(action->
meta, strdup(field), value_ms);
967 g_hash_table_remove(action->
meta, field);
972 value = g_hash_table_lookup(action->
meta,
"requires");
975 " is deprecated and will be removed in a future version"
976 " (use 'requires' resource meta-attribute instead)");
982 value =
"nothing (not start/promote)";
994 crm_notice(
"%s requires unfencing but fencing is disabled", action->
rsc->
id);
1001 crm_notice(
"%s requires fencing but fencing is disabled", action->
rsc->
id);
1007 value =
"fencing (resource)";
1011 value =
"quorum (resource)";
1015 value =
"nothing (resource)";
1020 value = unpack_operation_on_fail(action);
1022 if (value == NULL) {
1030 value =
"node fencing";
1033 crm_config_err(
"Specifying on_fail=fence and" " stonith-enabled=false makes no sense");
1036 value =
"stop resource";
1041 value =
"node standby";
1050 value =
"force migration";
1055 value =
"stop resource";
1059 value =
"restart (and possibly migrate)";
1061 }
else if (
safe_str_eq(value,
"restart-container")) {
1064 value =
"restart container (and possibly migrate)";
1071 pe_err(
"Resource %s: Unknown failure type (%s)", action->
rsc->
id, value);
1076 if (value == NULL && container) {
1078 value =
"restart container (and possibly migrate) (default)";
1097 value =
"stop unmanaged baremetal remote node (enforcing default)";
1101 value =
"fence baremetal remote node (default)";
1103 value =
"recover baremetal remote node connection (default)";
1115 value =
"resource fence (default)";
1119 value =
"resource block (default)";
1122 }
else if (value == NULL) {
1124 value =
"restart (and possibly migrate) (default)";
1130 if (xml_obj != NULL) {
1131 value = g_hash_table_lookup(action->
meta,
"role_after_failure");
1150 unpack_start_delay(value, action->
meta);
1153 unpack_interval_origin(value, action->
meta, xml_obj, interval, data_set->
now);
1157 value = g_hash_table_lookup(action->
meta, field);
1158 timeout = unpack_timeout(value, action, xml_obj, interval, data_set->
config_hash);
1161 #if ENABLE_VERSIONED_ATTRS
1162 unpack_versioned_meta(rsc_details->versioned_meta, xml_obj, interval,
1168 find_rsc_op_entry_helper(
resource_t * rsc,
const char *key, gboolean include_disabled)
1170 unsigned long long number = 0;
1171 gboolean do_retry = TRUE;
1172 char *local_key = NULL;
1173 const char *name = NULL;
1174 const char *value = NULL;
1175 const char *interval = NULL;
1176 char *match_key = NULL;
1178 xmlNode *operation = NULL;
1181 for (operation = __xml_first_child(rsc->
ops_xml); operation != NULL;
1182 operation = __xml_next_element(operation)) {
1183 if (
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
1187 if (!include_disabled && value &&
crm_is_true(value) == FALSE) {
1214 if (do_retry == FALSE) {
1224 }
else if (strstr(key,
"_notify_")) {
1236 return find_rsc_op_entry_helper(rsc, key, FALSE);
1243 crm_trace(
"%s%s: <NULL>", pre_text == NULL ?
"" : pre_text, pre_text == NULL ?
"" :
": ");
1248 crm_trace(
"%s%s%sNode %s: (weight=%d, fixed=%s)",
1249 pre_text == NULL ?
"" : pre_text,
1250 pre_text == NULL ?
"" :
": ",
1255 char *pe_mutable = strdup(
"\t\t");
1264 for (; gIter != NULL; gIter = gIter->next) {
1279 user_data == NULL ?
"" : (
char *)user_data,
1280 user_data == NULL ?
"" :
": ", (
char *)key, (
char *)value);
1290 pre_text == NULL ?
"" : pre_text, pre_text == NULL ?
"" :
": ");
1296 rsc->
fns->
print(rsc, pre_text, options, &log_level);
1302 if (action == NULL) {
1307 if (action->
extra) {
1308 g_hash_table_destroy(action->
extra);
1311 g_hash_table_destroy(action->
meta);
1313 #if ENABLE_VERSIONED_ATTRS
1315 pe_free_rsc_action_details(action);
1329 const char *value = NULL;
1335 for (; gIter != NULL; gIter = gIter->next) {
1339 if (value == NULL) {
1345 }
else if (not_on_node == NULL) {
1347 result = g_list_prepend(result, action);
1349 }
else if (action->
node == NULL) {
1353 result = g_list_prepend(result, action);
1374 crm_trace(
"Folding %s back into its atomic counterpart for %s", name, rsc->
id);
1391 for (gIter = input; gIter != NULL; gIter = gIter->next) {
1400 }
else if (on_node == NULL) {
1403 }
else if (action->
node == NULL) {
1422 for (; gIter != NULL; gIter = gIter->next) {
1426 crm_trace(
"%s does not match action %s", key, action->
uuid);
1429 }
else if (on_node == NULL) {
1430 crm_trace(
"Action %s matches (ignoring node)", key);
1431 result = g_list_prepend(result, action);
1433 }
else if (action->
node == NULL) {
1434 crm_trace(
"Action %s matches (unallocated, assigning to %s)",
1438 result = g_list_prepend(result, action);
1442 result = g_list_prepend(result, action);
1445 crm_trace(
"Action %s on node %s does not match requested node %s",
1462 for (; gIter != NULL; gIter = gIter->next) {
1470 }
else if (on_node == NULL || action->
node == NULL) {
1471 crm_trace(
"on_node=%p, action->node=%p", on_node, action->
node);
1475 result = g_list_prepend(result, action);
1484 resource_node_score(
resource_t * rsc,
node_t * node,
int score,
const char *tag)
1499 for (; gIter != NULL; gIter = gIter->next) {
1502 resource_node_score(child_rsc, node, score, tag);
1508 if (match == NULL) {
1520 resource_node_score(rsc, node, score, tag);
1522 }
else if (data_set != NULL) {
1525 for (; gIter != NULL; gIter = gIter->next) {
1528 resource_node_score(rsc, node_iter, score, tag);
1533 node_t *node_iter = NULL;
1536 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node_iter)) {
1537 resource_node_score(rsc, node_iter, score, tag);
1541 if (node == NULL && score == -
INFINITY) {
1550 #define sort_return(an_int, why) do { \
1553 crm_trace("%s (%d) %c %s (%d) : %s", \
1554 a_xml_id, a_call_id, an_int>0?'>':an_int<0?'<':'=', \
1555 b_xml_id, b_call_id, why); \
1565 char *a_uuid = NULL;
1566 char *b_uuid = NULL;
1568 const xmlNode *xml_a = a;
1569 const xmlNode *xml_b = b;
1580 pe_err(
"Duplicate lrm_rsc_op entries named %s", a_xml_id);
1587 if (a_call_id == -1 && b_call_id == -1) {
1593 }
else if (a_call_id >= 0 && a_call_id < b_call_id) {
1596 }
else if (b_call_id >= 0 && a_call_id > b_call_id) {
1599 }
else if (b_call_id >= 0 && a_call_id == b_call_id) {
1610 crm_trace(
"rc-change: %d vs %d", last_a, last_b);
1611 if (last_a >= 0 && last_a < last_b) {
1614 }
else if (last_b >= 0 && last_a > last_b) {
1654 if (b_call_id == -1) {
1657 }
else if (a_call_id == -1) {
1661 }
else if ((a_id >= 0 && a_id < b_id) || b_id == -1) {
1664 }
else if ((b_id >= 0 && a_id > b_id) || a_id == -1) {
1678 if (data_set->
now == NULL) {
1697 if (value == NULL ||
safe_str_eq(
"started", value)
1715 crm_config_err(
"%s is not part of a master/slave resource, a %s of '%s' makes no sense",
1736 if (lh_action == NULL || rh_action == NULL) {
1747 for (; gIter != NULL; gIter = gIter->next) {
1750 if (after->
action == rh_action && (after->
type & order)) {
1756 wrapper->
action = rh_action;
1757 wrapper->
type = order;
1760 list = g_list_prepend(list, wrapper);
1769 wrapper->
action = lh_action;
1770 wrapper->
type = order;
1772 list = g_list_prepend(list, wrapper);
1783 op = g_hash_table_lookup(data_set->
singletons, name);
1786 op =
custom_action(NULL, strdup(name), name, NULL, TRUE, TRUE, data_set);
1799 if (ticket->
state) {
1800 g_hash_table_destroy(ticket->
state);
1811 if (ticket_id == NULL || strlen(ticket_id) == 0) {
1815 if (data_set->
tickets == NULL) {
1820 ticket = g_hash_table_lookup(data_set->
tickets, ticket_id);
1821 if (ticket == NULL) {
1823 ticket = calloc(1,
sizeof(
ticket_t));
1824 if (ticket == NULL) {
1825 crm_err(
"Cannot allocate ticket '%s'", ticket_id);
1829 crm_trace(
"Creaing ticket entry for %s", ticket_id);
1831 ticket->
id = strdup(ticket_id);
1835 ticket->
state = crm_str_table_new();
1837 g_hash_table_insert(data_set->
tickets, strdup(ticket->
id), ticket);
1844 filter_parameters(xmlNode * param_set,
const char *param_string,
bool need_present)
1846 if (param_set && param_string) {
1847 xmlAttrPtr xIter = param_set->properties;
1850 const char *prop_name = (
const char *)xIter->name;
1852 char *match = strstr(param_string, name);
1857 xIter = xIter->next;
1859 if (need_present && match == NULL) {
1860 crm_trace(
"%s not found in %s", prop_name, param_string);
1863 }
else if (need_present == FALSE && match) {
1864 crm_trace(
"%s found in %s", prop_name, param_string);
1871 #if ENABLE_VERSIONED_ATTRS
1873 append_versioned_params(xmlNode *versioned_params,
const char *ra_version, xmlNode *params)
1875 GHashTable *hash = pe_unpack_versioned_parameters(versioned_params, ra_version);
1880 g_hash_table_iter_init(&iter, hash);
1881 while (g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &value)) {
1884 g_hash_table_destroy(hash);
1889 rsc_action_digest(
resource_t * rsc,
const char *task,
const char *key,
1896 GHashTable *local_rsc_params = crm_str_table_new();
1898 #if ENABLE_VERSIONED_ATTRS
1900 const char *ra_version = NULL;
1903 const char *op_version;
1904 const char *restart_list = NULL;
1905 const char *secure_list =
" passwd password ";
1911 #if ENABLE_VERSIONED_ATTRS
1912 pe_get_versioned_attributes(local_versioned_params, rsc, node, data_set);
1932 #if ENABLE_VERSIONED_ATTRS
1940 #if ENABLE_VERSIONED_ATTRS
1941 append_versioned_params(local_versioned_params, ra_version, data->
params_all);
1942 append_versioned_params(rsc->versioned_parameters, ra_version, data->
params_all);
1945 pe_rsc_action_details_t *details = pe_rsc_action_details(action);
1946 append_versioned_params(details->versioned_parameters, ra_version, data->
params_all);
1952 g_hash_table_destroy(local_rsc_params);
1988 const char *op_version;
1992 const char *digest_all;
1993 const char *digest_restart;
2003 data = rsc_action_digest(rsc, task, key, node, xml_op, data_set);
2007 pe_rsc_info(rsc,
"Parameters to %s on %s changed: was %s vs. now %s (restart:%s) %s",
2013 }
else if (digest_all == NULL) {
2018 pe_rsc_info(rsc,
"Parameters to %s on %s changed: was %s vs. now %s (%s:%s) %s",
2021 (interval > 0)?
"reschedule" :
"reload",
2030 #define STONITH_DIGEST_TASK "stonith-on"
2050 if (digest_all == NULL) {
2054 }
else if (strstr(digest_all, search_all)) {
2058 if(strstr(digest_secure, search_secure)) {
2060 printf(
"Only 'private' parameters to %s for unfencing %s changed\n",
2069 printf(
"Parameters to %s for unfencing %s changed, try '%s:%s:%s'\n",
2078 free(search_secure);
2086 return ID(rsc->
xml);
2097 for (; gIter != NULL; gIter = gIter->next) {
2110 for (; gIter != NULL; gIter = gIter->next) {
2120 for (
GListPtr gIter = candidates; gIter != NULL; gIter = gIter->next) {
2126 matches = find_unfencing_devices(candidate->
children, matches);
2130 }
else if (
crm_str_eq(provides,
"unfencing", FALSE) ||
crm_str_eq(requires,
"unfencing", FALSE)) {
2131 matches = g_list_prepend(matches, candidate);
2141 char *op_key = NULL;
2151 stonith_op = g_hash_table_lookup(data_set->
singletons, op_key);
2154 if(stonith_op == NULL) {
2171 long digests_all_offset = 0;
2172 long digests_secure_offset = 0;
2174 char *digests_all = malloc(max);
2175 char *digests_secure = malloc(max);
2178 for (
GListPtr gIter = matches; gIter != NULL; gIter = gIter->next) {
2187 fprintf(stdout,
" notice: Unfencing %s (remote): because the definition of %s changed\n", node->
details->
uname, match->
id);
2191 digests_all_offset += snprintf(
2192 digests_all+digests_all_offset, max-digests_all_offset,
2195 digests_secure_offset += snprintf(
2196 digests_secure+digests_secure_offset, max-digests_secure_offset,
2199 g_hash_table_insert(stonith_op->
meta,
2202 g_hash_table_insert(stonith_op->
meta,
2211 if(optional == FALSE &&
pe_can_fence(data_set, node)) {
2213 }
else if(reason && stonith_op->
reason == NULL) {
2214 stonith_op->
reason = strdup(reason);
2246 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
2255 add_tag_ref(GHashTable * tags,
const char * tag_name,
const char * obj_ref)
2259 gboolean is_existing = FALSE;
2261 CRM_CHECK(tags && tag_name && obj_ref,
return FALSE);
2263 tag = g_hash_table_lookup(tags, tag_name);
2265 tag = calloc(1,
sizeof(
tag_t));
2269 tag->
id = strdup(tag_name);
2271 g_hash_table_insert(tags, strdup(tag_name), tag);
2274 for (gIter = tag->
refs; gIter != NULL; gIter = gIter->next) {
2275 const char *existing_ref = (
const char *) gIter->data;
2277 if (
crm_str_eq(existing_ref, obj_ref, TRUE)){
2283 if (is_existing == FALSE) {
2284 tag->
refs = g_list_append(tag->
refs, strdup(obj_ref));
2285 crm_trace(
"Added: tag=%s ref=%s", tag->
id, obj_ref);
2296 bool update = FALSE;
2297 const char *change = NULL;
2301 change =
"unrunnable";
2304 change =
"required";
2306 change =
"fatally failed";
2310 change =
"unrunnable";
2312 change =
"dangling";
2314 change =
"required";
2316 crm_err(
"Unknown flag change to %s by %s: 0x%.16x",
2317 flags, action->
uuid, (reason? reason->
uuid : 0));
2321 if(is_set(action->
flags, flags)) {
2322 action->
flags = crm_clear_bit(
function, line, action->
uuid, action->
flags, flags);
2327 if(is_not_set(action->
flags, flags)) {
2328 action->
flags = crm_set_bit(
function, line, action->
uuid, action->
flags, flags);
2333 if((change && update) || text) {
2334 char *reason_text = NULL;
2335 if(reason == NULL) {
2338 }
else if(reason->
rsc == NULL) {
2344 if(reason_text && action->
rsc != reason->
rsc) {
2353 if(action->
reason && overwrite) {
2358 if(action->
reason == NULL) {
2361 action->
reason = strdup(reason);
#define XML_OP_ATTR_ORIGIN
#define CRM_CHECK(expr, failure_action)
#define XML_RSC_OP_LAST_CHANGE
enum rsc_start_requirement needs
#define crm_notice(fmt, args...)
#define CRMD_ACTION_MIGRATED
void dump_rsc_utilization(int level, const char *comment, resource_t *rsc, node_t *node)
#define pe_rsc_debug(rsc, fmt, args...)
#define pe_flag_have_stonith_resource
void crm_time_add_seconds(crm_time_t *dt, int value)
gboolean safe_str_neq(const char *a, const char *b)
#define pe_rsc_needs_unfencing
gint sort_rsc_priority(gconstpointer a, gconstpointer b)
#define XML_OP_ATTR_DIGESTS_ALL
gint sort_rsc_index(gconstpointer a, gconstpointer b)
gboolean get_target_role(resource_t *rsc, enum rsc_role_e *role)
#define XML_ATTR_TRANSITION_MAGIC
node_t * node_copy(const node_t *this_node)
int crm_element_value_const_int(const xmlNode *data, const char *name, int *dest)
GListPtr node_list_dup(GListPtr list, gboolean reset, gboolean filter)
#define crm_time_log_timeofday
#define pe_flag_enable_unfencing
bool pe_can_fence(pe_working_set_t *data_set, node_t *node)
struct crm_time_s crm_time_t
#define crm_config_err(fmt...)
enum action_tasks get_complex_task(resource_t *rsc, const char *name, gboolean allow_non_atomic)
xmlNode * get_object_root(const char *object_type, xmlNode *the_root)
#define pe_action_required(action, reason, text)
#define pe_rsc_needs_quorum
gboolean exclusive_discover
action_t * pe_fence_op(node_t *node, const char *op, bool optional, const char *reason, pe_working_set_t *data_set)
enum action_fail_response on_fail
GListPtr find_actions_exact(GListPtr input, const char *key, node_t *on_node)
long long crm_get_msec(const char *input)
GListPtr find_actions(GListPtr input, const char *key, const node_t *on_node)
enum pe_obj_types variant
char * score2char_stack(int score, char *buf, size_t len)
#define XML_LRM_ATTR_INTERVAL
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)
#define XML_LRM_ATTR_OP_DIGEST
#define CRMD_ACTION_PROMOTE
#define XML_LRM_ATTR_OP_RESTART
int crm_parse_int(const char *text, const char *default_text)
void get_rsc_attributes(GHashTable *meta_hash, resource_t *rsc, node_t *node, pe_working_set_t *data_set)
void print_node(const char *pre_text, node_t *node, gboolean details)
#define XML_NVPAIR_ATTR_NAME
#define XML_OP_ATTR_DIGESTS_SECURE
gint sort_op_by_callid(gconstpointer a, gconstpointer b)
#define CRM_ATTR_DIGESTS_ALL
enum action_tasks text2task(const char *task)
time_t get_effective_time(pe_working_set_t *data_set)
no_quorum_policy_t no_quorum_policy
const char * pe_pref(GHashTable *options, const char *name)
#define do_crm_log_alias(level, file, function, line, fmt, args...)
Log a message as if it came from a different code location.
resource_t * uber_parent(resource_t *rsc)
void set_bit_recursive(resource_t *rsc, unsigned long long flag)
#define clear_bit(word, bit)
#define XML_RSC_ATTR_PROVIDES
action_t * get_pseudo_op(const char *name, pe_working_set_t *data_set)
void filter_action_parameters(xmlNode *param_set, const char *version)
#define XML_OP_ATTR_ON_FAIL
GListPtr find_recurring_actions(GListPtr input, node_t *not_on_node)
#define crm_time_log_duration
#define XML_LRM_ATTR_OP_SECURE
gboolean is_rsc_baremetal_remote_node(resource_t *rsc, pe_working_set_t *data_set)
#define CRMD_ACTION_START
xmlNode * copy_xml(xmlNode *src_node)
gboolean ghash_free_str_str(gpointer key, gpointer value, gpointer user_data)
#define XML_TAG_ATTR_SETS
#define XML_LRM_ATTR_TASK
const char * role2text(enum rsc_role_e role)
gboolean is_remote_node(node_t *node)
void hash2field(gpointer key, gpointer value, gpointer user_data)
gboolean(* active)(resource_t *, gboolean)
struct node_shared_s * details
char * calculate_operation_digest(xmlNode *local_cib, const char *version)
Calculate and return digest of XML operation.
#define CRMD_ACTION_DEMOTE
void pe_action_set_reason(pe_action_t *action, const char *reason, bool overwrite)
#define set_bit(word, bit)
#define XML_RSC_ATTR_REQUIRES
#define crm_debug(fmt, args...)
unsigned long long crm_get_interval(const char *input)
crm_time_t * crm_time_calculate_duration(crm_time_t *dt, crm_time_t *value)
resource_object_functions_t * fns
#define sort_return(an_int, why)
GHashTable * allowed_nodes
GHashTable * digest_cache
pe_working_set_t * pe_dataset
#define crm_trace(fmt, args...)
#define do_crm_log(level, fmt, args...)
Log a message.
enum rsc_digest_cmp_val rc
action_t * find_first_action(GListPtr input, const char *uuid, const char *task, node_t *on_node)
char * digest_secure_calc
gboolean is_container_remote_node(node_t *node)
const char * stonith_action
const char * crm_element_value_const(const xmlNode *data, const char *name)
#define XML_TAG_OP_VER_META
void pe_fence_node(pe_working_set_t *data_set, node_t *node, const char *reason)
Schedule a fence action for a node.
#define XML_TAG_META_SETS
Wrappers for and extensions to libxml2.
const char * container_fix_remote_addr_in(resource_t *rsc, xmlNode *xml, const char *field)
gboolean add_tag_ref(GHashTable *tags, const char *tag_name, const char *obj_ref)
xmlNode * create_xml_node(xmlNode *parent, const char *name)
long long int crm_time_get_seconds_since_epoch(crm_time_t *dt)
const char * crm_element_value(xmlNode *data, const char *name)
action_t * custom_action(resource_t *rsc, char *key, const char *task, node_t *on_node, gboolean optional, gboolean foo, pe_working_set_t *data_set)
#define CRM_ATTR_DIGESTS_SECURE
const char * pe_node_attribute_raw(pe_node_t *node, const char *name)
xmlNode * crm_next_same_xml(xmlNode *sibling)
Get next instance of same XML tag.
#define CRM_DEFAULT_OP_TIMEOUT_S
#define crm_time_log(level, prefix, dt, flags)
xmlNode * find_rsc_op_entry(resource_t *rsc, const char *key)
#define XML_RSC_ATTR_TARGET_ROLE
#define XML_LRM_ATTR_RESTART_DIGEST
void unpack_operation(action_t *action, xmlNode *xml_obj, resource_t *container, pe_working_set_t *data_set)
#define XML_TAG_RSC_VER_ATTRS
void free_xml(xmlNode *child)
#define crm_time_log_with_timezone
enum rsc_role_e text2role(const char *role)
gboolean crm_str_eq(const char *a, const char *b, gboolean use_case)
int remote_reconnect_interval
#define XML_LRM_ATTR_TARGET_UUID
long long int crm_time_get_seconds(crm_time_t *dt)
void hash2metafield(gpointer key, gpointer value, gpointer user_data)
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
const char * crm_xml_add_int(xmlNode *node, const char *name, int value)
GHashTable * node_hash_from_list(GListPtr list)
void add_hash_param(GHashTable *hash, const char *name, const char *value)
#define pe_set_action_bit(action, bit)
#define crm_err(fmt, args...)
void resource_location(resource_t *rsc, node_t *node, int score, const char *tag, pe_working_set_t *data_set)
int pe_get_configured_timeout(resource_t *rsc, const char *action, pe_working_set_t *data_set)
void node_list_exclude(GHashTable *list, GListPtr list2, gboolean merge_scores)
void(* print)(resource_t *, const char *, long, void *)
ticket_t * ticket_new(const char *ticket_id, pe_working_set_t *data_set)
crm_time_t * crm_time_new(const char *string)
#define pe_clear_action_bit(action, bit)
enum rsc_role_e next_role
void xml_remove_prop(xmlNode *obj, const char *name)
void print_str_str(gpointer key, gpointer value, gpointer user_data)
void dump_node_capacity(int level, const char *comment, node_t *node)
int merge_weights(int w1, int w2)
#define XML_LRM_ATTR_CALLID
#define CRMD_ACTION_MIGRATE
#define XML_NVPAIR_ATTR_VALUE
enum rsc_role_e fail_role
gboolean remote_requires_reset
#define XML_ATTR_CRM_VERSION
int crm_time_compare(crm_time_t *dt, crm_time_t *rhs)
gboolean decode_transition_magic(const char *magic, char **uuid, int *transition_id, int *action_id, int *op_status, int *op_rc, int *target_rc)
node_t * pe_find_node_id(GListPtr node_list, const char *id)
enum pe_action_flags flags
#define XML_OP_ATTR_START_DELAY
void dump_node_scores_worker(int level, const char *file, const char *function, int line, resource_t *rsc, const char *comment, GHashTable *nodes)
void pe_free_action(action_t *action)
void clear_bit_recursive(resource_t *rsc, unsigned long long flag)
#define pe_flag_have_quorum
void destroy_ticket(gpointer data)
void unpack_instance_attributes(xmlNode *top, xmlNode *xml_obj, const char *set_name, GHashTable *node_hash, GHashTable *hash, const char *always_first, gboolean overwrite, crm_time_t *now)
xmlNode * first_named_child(xmlNode *parent, const char *name)
gboolean crm_is_true(const char *s)
#define XML_LRM_ATTR_TARGET
#define pe_rsc_trace(rsc, fmt, args...)
char * generate_op_key(const char *rsc_id, const char *op_type, int interval)
Generate an operation key.
void print_resource(int log_level, const char *pre_text, resource_t *rsc, gboolean details)
char * crm_itoa(int an_int)
#define pe_rsc_needs_fencing
#define safe_str_eq(a, b)
gboolean order_actions(action_t *lh_action, action_t *rh_action, enum pe_ordering order)
op_digest_cache_t * rsc_action_digest_cmp(resource_t *rsc, xmlNode *xml_op, node_t *node, pe_working_set_t *data_set)
char * crm_strdup_printf(char const *format,...) __attribute__((__format__(__printf__
gint sort_node_uname(gconstpointer a, gconstpointer b)
#define pe_flag_sanitized
#define pe_rsc_fence_device
#define STONITH_DIGEST_TASK
#define CRMD_ACTION_CANCEL
#define crm_info(fmt, args...)
char * digest_restart_calc
void g_hash_destroy_str(gpointer data)
#define crm_time_log_date
void trigger_unfencing(resource_t *rsc, node_t *node, const char *reason, action_t *dependency, pe_working_set_t *data_set)
const char * rsc_printable_id(resource_t *rsc)
#define XML_ATTR_RA_VERSION
#define XML_TAG_OP_VER_ATTRS
#define pe_flag_stonith_enabled
#define pe_warn_once(pe_wo_bit, fmt...)
#define pe_rsc_info(rsc, fmt, args...)
#define CRMD_ACTION_STATUS
void crm_time_free(crm_time_t *dt)