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,
286 node->details->uname, score);
289 node->details->uname, score);
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)");
844 #if ENABLE_VERSIONED_ATTRS 846 unpack_versioned_meta(xmlNode *versioned_meta, xmlNode *xml_obj,
unsigned long long interval,
crm_time_t *now)
848 xmlNode *attrs = NULL;
849 xmlNode *attr = NULL;
851 for (attrs = __xml_first_child(versioned_meta); attrs != NULL; attrs = __xml_next_element(attrs)) {
852 for (attr = __xml_first_child(attrs); attr != NULL; attr = __xml_next_element(attr)) {
857 int start_delay = unpack_start_delay(value, NULL);
861 int start_delay = unpack_interval_origin(value, NULL, xml_obj, interval, now);
866 int timeout = unpack_timeout(value, NULL, NULL, 0, NULL);
879 unsigned long long interval = 0;
881 char *value_ms = NULL;
882 const char *value = NULL;
883 const char *field = NULL;
884 #if ENABLE_VERSIONED_ATTRS 885 pe_rsc_action_details_t *rsc_details = NULL;
891 action->
meta, NULL, FALSE, data_set->
now);
894 xmlAttrPtr xIter = NULL;
896 for (xIter = xml_obj->properties; xIter; xIter = xIter->next) {
897 const char *prop_name = (
const char *)xIter->name;
900 g_hash_table_replace(action->
meta, strdup(prop_name), strdup(prop_value));
905 NULL, action->
meta, NULL, FALSE, data_set->
now);
908 NULL, action->
meta, NULL, FALSE, data_set->
now);
910 #if ENABLE_VERSIONED_ATTRS 911 rsc_details = pe_rsc_action_details(action);
913 rsc_details->versioned_parameters, data_set->
now);
915 rsc_details->versioned_meta, data_set->
now);
918 g_hash_table_remove(action->
meta,
"id");
921 value = g_hash_table_lookup(action->
meta, field);
926 g_hash_table_replace(action->
meta, strdup(field), value_ms);
929 g_hash_table_remove(action->
meta, field);
934 value = g_hash_table_lookup(action->
meta,
"requires");
937 " is deprecated and will be removed in a future version" 938 " (use 'requires' resource meta-attribute instead)");
944 value =
"nothing (not start/promote)";
956 crm_notice(
"%s requires unfencing but fencing is disabled", action->
rsc->
id);
963 crm_notice(
"%s requires fencing but fencing is disabled", action->
rsc->
id);
969 value =
"fencing (resource)";
973 value =
"quorum (resource)";
977 value =
"nothing (resource)";
982 value = unpack_operation_on_fail(action);
992 value =
"node fencing";
995 crm_config_err(
"Specifying on_fail=fence and" " stonith-enabled=false makes no sense");
998 value =
"stop resource";
1003 value =
"node standby";
1012 value =
"force migration";
1017 value =
"stop resource";
1021 value =
"restart (and possibly migrate)";
1023 }
else if (
safe_str_eq(value,
"restart-container")) {
1026 value =
"restart container (and possibly migrate)";
1033 pe_err(
"Resource %s: Unknown failure type (%s)", action->
rsc->
id, value);
1038 if (value == NULL && container) {
1040 value =
"restart container (and possibly migrate) (default)";
1059 value =
"stop unmanaged baremetal remote node (enforcing default)";
1063 value =
"fence baremetal remote node (default)";
1065 value =
"recover baremetal remote node connection (default)";
1077 value =
"resource fence (default)";
1081 value =
"resource block (default)";
1084 }
else if (value == NULL) {
1086 value =
"restart (and possibly migrate) (default)";
1092 if (xml_obj != NULL) {
1093 value = g_hash_table_lookup(action->
meta,
"role_after_failure");
1112 unpack_start_delay(value, action->
meta);
1115 unpack_interval_origin(value, action->
meta, xml_obj, interval, data_set->
now);
1119 value = g_hash_table_lookup(action->
meta, field);
1120 timeout = unpack_timeout(value, action, xml_obj, interval, data_set->
config_hash);
1123 #if ENABLE_VERSIONED_ATTRS 1124 unpack_versioned_meta(rsc_details->versioned_meta, xml_obj, interval,
1130 find_rsc_op_entry_helper(
resource_t * rsc,
const char *key, gboolean include_disabled)
1132 unsigned long long number = 0;
1133 gboolean do_retry = TRUE;
1134 char *local_key = NULL;
1135 const char *name = NULL;
1136 const char *value = NULL;
1137 const char *interval = NULL;
1138 char *match_key = NULL;
1140 xmlNode *operation = NULL;
1143 for (operation = __xml_first_child(rsc->
ops_xml); operation != NULL;
1144 operation = __xml_next_element(operation)) {
1145 if (
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
1149 if (!include_disabled && value &&
crm_is_true(value) == FALSE) {
1176 if (do_retry == FALSE) {
1186 }
else if (strstr(key,
"_notify_")) {
1198 return find_rsc_op_entry_helper(rsc, key, FALSE);
1205 crm_trace(
"%s%s: <NULL>", pre_text == NULL ?
"" : pre_text, pre_text == NULL ?
"" :
": ");
1210 crm_trace(
"%s%s%sNode %s: (weight=%d, fixed=%s)",
1211 pre_text == NULL ?
"" : pre_text,
1212 pre_text == NULL ?
"" :
": ",
1217 char *pe_mutable = strdup(
"\t\t");
1226 for (; gIter != NULL; gIter = gIter->next) {
1241 user_data == NULL ?
"" : (
char *)user_data,
1242 user_data == NULL ?
"" :
": ", (
char *)key, (
char *)value);
1252 pre_text == NULL ?
"" : pre_text, pre_text == NULL ?
"" :
": ");
1258 rsc->
fns->
print(rsc, pre_text, options, &log_level);
1264 if (action == NULL) {
1269 if (action->
extra) {
1270 g_hash_table_destroy(action->
extra);
1273 g_hash_table_destroy(action->
meta);
1275 #if ENABLE_VERSIONED_ATTRS 1277 pe_free_rsc_action_details(action);
1291 const char *value = NULL;
1297 for (; gIter != NULL; gIter = gIter->next) {
1301 if (value == NULL) {
1307 }
else if (not_on_node == NULL) {
1309 result = g_list_prepend(result, action);
1311 }
else if (action->
node == NULL) {
1315 result = g_list_prepend(result, action);
1336 crm_trace(
"Folding %s back into its atomic counterpart for %s", name, rsc->
id);
1353 for (gIter = input; gIter != NULL; gIter = gIter->next) {
1362 }
else if (on_node == NULL) {
1365 }
else if (action->
node == NULL) {
1384 for (; gIter != NULL; gIter = gIter->next) {
1388 crm_trace(
"%s does not match action %s", key, action->
uuid);
1391 }
else if (on_node == NULL) {
1392 crm_trace(
"Action %s matches (ignoring node)", key);
1393 result = g_list_prepend(result, action);
1395 }
else if (action->
node == NULL) {
1396 crm_trace(
"Action %s matches (unallocated, assigning to %s)",
1400 result = g_list_prepend(result, action);
1404 result = g_list_prepend(result, action);
1407 crm_trace(
"Action %s on node %s does not match requested node %s",
1424 for (; gIter != NULL; gIter = gIter->next) {
1432 }
else if (on_node == NULL || action->
node == NULL) {
1433 crm_trace(
"on_node=%p, action->node=%p", on_node, action->
node);
1437 result = g_list_prepend(result, action);
1446 resource_node_score(
resource_t * rsc,
node_t * node,
int score,
const char *tag)
1453 for (; gIter != NULL; gIter = gIter->next) {
1456 resource_node_score(child_rsc, node, score, tag);
1462 if (match == NULL) {
1474 resource_node_score(rsc, node, score, tag);
1476 }
else if (data_set != NULL) {
1479 for (; gIter != NULL; gIter = gIter->next) {
1482 resource_node_score(rsc, node_iter, score, tag);
1487 node_t *node_iter = NULL;
1490 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node_iter)) {
1491 resource_node_score(rsc, node_iter, score, tag);
1495 if (node == NULL && score == -
INFINITY) {
1504 #define sort_return(an_int, why) do { \ 1507 crm_trace("%s (%d) %c %s (%d) : %s", \ 1508 a_xml_id, a_call_id, an_int>0?'>':an_int<0?'<':'=', \ 1509 b_xml_id, b_call_id, why); \ 1519 char *a_uuid = NULL;
1520 char *b_uuid = NULL;
1522 const xmlNode *xml_a = a;
1523 const xmlNode *xml_b = b;
1534 pe_err(
"Duplicate lrm_rsc_op entries named %s", a_xml_id);
1541 if (a_call_id == -1 && b_call_id == -1) {
1547 }
else if (a_call_id >= 0 && a_call_id < b_call_id) {
1550 }
else if (b_call_id >= 0 && a_call_id > b_call_id) {
1553 }
else if (b_call_id >= 0 && a_call_id == b_call_id) {
1564 crm_trace(
"rc-change: %d vs %d", last_a, last_b);
1565 if (last_a >= 0 && last_a < last_b) {
1568 }
else if (last_b >= 0 && last_a > last_b) {
1608 if (b_call_id == -1) {
1611 }
else if (a_call_id == -1) {
1615 }
else if ((a_id >= 0 && a_id < b_id) || b_id == -1) {
1618 }
else if ((b_id >= 0 && a_id > b_id) || a_id == -1) {
1632 if (data_set->
now == NULL) {
1651 if (value == NULL ||
safe_str_eq(
"started", value)
1669 crm_config_err(
"%s is not part of a master/slave resource, a %s of '%s' makes no sense",
1690 if (lh_action == NULL || rh_action == NULL) {
1701 for (; gIter != NULL; gIter = gIter->next) {
1704 if (after->
action == rh_action && (after->
type & order)) {
1710 wrapper->
action = rh_action;
1711 wrapper->
type = order;
1714 list = g_list_prepend(list, wrapper);
1723 wrapper->
action = lh_action;
1724 wrapper->
type = order;
1726 list = g_list_prepend(list, wrapper);
1737 op = g_hash_table_lookup(data_set->
singletons, name);
1740 op =
custom_action(NULL, strdup(name), name, NULL, TRUE, TRUE, data_set);
1753 if (ticket->
state) {
1754 g_hash_table_destroy(ticket->
state);
1765 if (ticket_id == NULL || strlen(ticket_id) == 0) {
1769 if (data_set->
tickets == NULL) {
1774 ticket = g_hash_table_lookup(data_set->
tickets, ticket_id);
1775 if (ticket == NULL) {
1777 ticket = calloc(1,
sizeof(
ticket_t));
1778 if (ticket == NULL) {
1779 crm_err(
"Cannot allocate ticket '%s'", ticket_id);
1783 crm_trace(
"Creaing ticket entry for %s", ticket_id);
1785 ticket->
id = strdup(ticket_id);
1789 ticket->
state = crm_str_table_new();
1791 g_hash_table_insert(data_set->
tickets, strdup(ticket->
id), ticket);
1798 filter_parameters(xmlNode * param_set,
const char *param_string,
bool need_present)
1800 if (param_set && param_string) {
1801 xmlAttrPtr xIter = param_set->properties;
1804 const char *prop_name = (
const char *)xIter->name;
1806 char *match = strstr(param_string, name);
1811 xIter = xIter->next;
1813 if (need_present && match == NULL) {
1814 crm_trace(
"%s not found in %s", prop_name, param_string);
1817 }
else if (need_present == FALSE && match) {
1818 crm_trace(
"%s found in %s", prop_name, param_string);
1829 const char *attr_list[] = {
1834 const char *value_list[] = {
1845 value = g_hash_table_lookup(rsc->
parameters, name);
1850 for (
int lpc = 0; lpc <
DIMOF(attr_list); lpc++) {
1851 name = attr_list[lpc];
1853 if (
safe_str_eq(value, value_list[lpc]) == FALSE) {
1861 #if ENABLE_VERSIONED_ATTRS 1863 append_versioned_params(xmlNode *versioned_params,
const char *ra_version, xmlNode *params)
1865 GHashTable *hash = pe_unpack_versioned_parameters(versioned_params, ra_version);
1870 g_hash_table_iter_init(&iter, hash);
1871 while (g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &value)) {
1874 g_hash_table_destroy(hash);
1879 rsc_action_digest(
resource_t * rsc,
const char *task,
const char *key,
1886 GHashTable *local_rsc_params = crm_str_table_new();
1888 #if ENABLE_VERSIONED_ATTRS 1890 const char *ra_version = NULL;
1893 const char *op_version;
1894 const char *restart_list = NULL;
1895 const char *secure_list =
" passwd password ";
1901 #if ENABLE_VERSIONED_ATTRS 1902 pe_get_versioned_attributes(local_versioned_params, rsc, node, data_set);
1922 #if ENABLE_VERSIONED_ATTRS 1930 #if ENABLE_VERSIONED_ATTRS 1931 append_versioned_params(local_versioned_params, ra_version, data->
params_all);
1932 append_versioned_params(rsc->versioned_parameters, ra_version, data->
params_all);
1935 pe_rsc_action_details_t *details = pe_rsc_action_details(action);
1936 append_versioned_params(details->versioned_parameters, ra_version, data->
params_all);
1942 g_hash_table_destroy(local_rsc_params);
1981 const char *digest_all;
1982 const char *digest_restart;
1991 data = rsc_action_digest(rsc, task, key, node, xml_op, data_set);
1997 }
else if (digest_all == NULL) {
2009 #define STONITH_DIGEST_TASK "stonith-on" 2029 if (digest_all == NULL) {
2033 }
else if (strstr(digest_all, search_all)) {
2037 if(strstr(digest_secure, search_secure)) {
2039 printf(
"Only 'private' parameters to %s for unfencing %s changed\n",
2048 printf(
"Parameters to %s for unfencing %s changed, try '%s:%s:%s'\n",
2057 free(search_secure);
2065 return ID(rsc->
xml);
2076 for (; gIter != NULL; gIter = gIter->next) {
2089 for (; gIter != NULL; gIter = gIter->next) {
2099 for (
GListPtr gIter = candidates; gIter != NULL; gIter = gIter->next) {
2105 matches = find_unfencing_devices(candidate->
children, matches);
2109 }
else if (
crm_str_eq(provides,
"unfencing", FALSE) ||
crm_str_eq(requires,
"unfencing", FALSE)) {
2110 matches = g_list_prepend(matches, candidate);
2120 char *op_key = NULL;
2130 stonith_op = g_hash_table_lookup(data_set->
singletons, op_key);
2133 if(stonith_op == NULL) {
2150 long digests_all_offset = 0;
2151 long digests_secure_offset = 0;
2153 char *digests_all = malloc(max);
2154 char *digests_secure = malloc(max);
2157 for (
GListPtr gIter = matches; gIter != NULL; gIter = gIter->next) {
2166 fprintf(stdout,
" notice: Unfencing %s (remote): because the definition of %s changed\n", node->
details->
uname, match->
id);
2170 digests_all_offset += snprintf(
2171 digests_all+digests_all_offset, max-digests_all_offset,
2174 digests_secure_offset += snprintf(
2175 digests_secure+digests_secure_offset, max-digests_secure_offset,
2178 g_hash_table_insert(stonith_op->
meta,
2181 g_hash_table_insert(stonith_op->
meta,
2190 if(optional == FALSE &&
pe_can_fence(data_set, node)) {
2192 }
else if(reason && stonith_op->
reason == NULL) {
2193 stonith_op->
reason = strdup(reason);
2225 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
2226 if(node->details->online && node->details->unclean == FALSE && node->details->shutdown == FALSE) {
2234 add_tag_ref(GHashTable * tags,
const char * tag_name,
const char * obj_ref)
2238 gboolean is_existing = FALSE;
2240 CRM_CHECK(tags && tag_name && obj_ref,
return FALSE);
2242 tag = g_hash_table_lookup(tags, tag_name);
2244 tag = calloc(1,
sizeof(
tag_t));
2248 tag->
id = strdup(tag_name);
2250 g_hash_table_insert(tags, strdup(tag_name), tag);
2253 for (gIter = tag->
refs; gIter != NULL; gIter = gIter->next) {
2254 const char *existing_ref = (
const char *) gIter->data;
2256 if (
crm_str_eq(existing_ref, obj_ref, TRUE)){
2262 if (is_existing == FALSE) {
2263 tag->
refs = g_list_append(tag->
refs, strdup(obj_ref));
2264 crm_trace(
"Added: tag=%s ref=%s", tag->
id, obj_ref);
2275 bool update = FALSE;
2276 const char *change = NULL;
2280 change =
"unrunnable";
2283 change =
"required";
2285 change =
"fatally failed";
2289 change =
"unrunnable";
2291 change =
"dangling";
2293 change =
"required";
2295 crm_err(
"Unknown flag change to %s by %s: 0x%.16x", flags, action->
uuid, reason->
uuid);
2299 if(is_set(action->
flags, flags)) {
2300 action->
flags = crm_clear_bit(
function, line, action->
uuid, action->
flags, flags);
2305 if(is_not_set(action->
flags, flags)) {
2306 action->
flags = crm_set_bit(
function, line, action->
uuid, action->
flags, flags);
2311 if((change && update) || text) {
2312 char *reason_text = NULL;
2313 if(reason == NULL) {
2316 }
else if(reason->
rsc == NULL) {
2322 if(reason_text && action->
rsc != reason->
rsc) {
2331 if(action->
reason == NULL || overwrite) {
2335 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
long long crm_get_msec(const char *input)
action_t * custom_action(resource_t *rsc, char *key, const char *task, node_t *on_node, gboolean optional, gboolean save_action, pe_working_set_t *data_set)
void destroy_ticket(gpointer data)
#define crm_notice(fmt, args...)
#define CRMD_ACTION_MIGRATED
enum action_tasks get_complex_task(resource_t *rsc, const char *name, gboolean allow_non_atomic)
#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
#define XML_OP_ATTR_DIGESTS_ALL
time_t get_effective_time(pe_working_set_t *data_set)
#define XML_ATTR_TRANSITION_MAGIC
GHashTable * node_hash_from_list(GListPtr list)
int crm_element_value_const_int(const xmlNode *data, const char *name, int *dest)
#define crm_time_log_timeofday
#define pe_flag_enable_unfencing
pe_working_set_t * pe_dataset
void node_list_exclude(GHashTable *hash, GListPtr list, gboolean merge_scores)
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)
struct crm_time_s crm_time_t
bool pe_can_fence(pe_working_set_t *data_set, node_t *node)
#define crm_config_err(fmt...)
#define pe_action_required(action, reason, text)
#define pe_rsc_needs_quorum
enum action_fail_response on_fail
gint sort_op_by_callid(gconstpointer a, gconstpointer b)
xmlNode * find_rsc_op_entry(resource_t *rsc, const char *key)
enum pe_obj_types variant
#define XML_LRM_ATTR_INTERVAL
#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)
#define XML_NVPAIR_ATTR_NAME
#define XML_OP_ATTR_DIGESTS_SECURE
#define CRM_ATTR_DIGESTS_ALL
enum action_tasks text2task(const char *task)
no_quorum_policy_t no_quorum_policy
GListPtr find_actions_exact(GListPtr input, const char *key, node_t *on_node)
const char * pe_pref(GHashTable *options, const char *name)
void dump_node_capacity(int level, const char *comment, node_t *node)
action_t * find_first_action(GListPtr input, const char *uuid, const char *task, node_t *on_node)
#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)
#define clear_bit(word, bit)
void resource_location(resource_t *rsc, node_t *node, int score, const char *tag, pe_working_set_t *data_set)
#define XML_RSC_ATTR_PROVIDES
void filter_action_parameters(xmlNode *param_set, const char *version)
#define XML_OP_ATTR_ON_FAIL
node_t * node_copy(const node_t *this_node)
gboolean get_target_role(resource_t *rsc, enum rsc_role_e *role)
void print_resource(int log_level, const char *pre_text, resource_t *rsc, gboolean details)
#define crm_time_log_duration
gboolean order_actions(action_t *lh_action, action_t *rh_action, enum pe_ordering order)
void pe_action_set_reason(pe_action_t *action, const char *reason, bool overwrite)
#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 add_tag_ref(GHashTable *tags, const char *tag_name, const char *obj_ref)
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
#define set_bit(word, bit)
#define XML_RSC_ATTR_REQUIRES
#define PCMK_RESOURCE_CLASS_OCF
#define crm_debug(fmt, args...)
GListPtr find_recurring_actions(GListPtr input, node_t *not_on_node)
crm_time_t * crm_time_calculate_duration(crm_time_t *dt, crm_time_t *value)
ticket_t * ticket_new(const char *ticket_id, pe_working_set_t *data_set)
resource_object_functions_t * fns
#define sort_return(an_int, why)
void pe_free_action(action_t *action)
GHashTable * allowed_nodes
unsigned long long crm_get_interval(const char *input)
GHashTable * digest_cache
#define crm_trace(fmt, args...)
#define do_crm_log(level, fmt, args...)
Log a message.
enum rsc_digest_cmp_val rc
void set_bit_recursive(resource_t *rsc, unsigned long long flag)
char * digest_secure_calc
void dump_rsc_utilization(int level, const char *comment, resource_t *rsc, node_t *node)
gboolean is_container_remote_node(node_t *node)
gint sort_node_uname(gconstpointer a, gconstpointer b)
bool fix_remote_addr(resource_t *rsc)
const char * stonith_action
const char * crm_element_value_const(const xmlNode *data, const char *name)
#define XML_TAG_OP_VER_META
action_t * pe_fence_op(node_t *node, const char *op, bool optional, const char *reason, pe_working_set_t *data_set)
#define XML_AGENT_ATTR_PROVIDER
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.
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)
#define CRM_ATTR_DIGESTS_SECURE
const char * pe_node_attribute_raw(pe_node_t *node, const char *name)
#define CRM_DEFAULT_OP_TIMEOUT_S
#define crm_time_log(level, prefix, dt, flags)
xmlNode * get_object_root(const char *object_type, xmlNode *the_root)
#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)
gboolean(* active)(resource_t *, gboolean)
void hash2metafield(gpointer key, gpointer value, gpointer user_data)
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
void dump_node_scores_worker(int level, const char *file, const char *function, int line, resource_t *rsc, const char *comment, GHashTable *nodes)
const char * crm_xml_add_int(xmlNode *node, const char *name, int value)
void(* print)(resource_t *, const char *, long, void *)
gint sort_rsc_index(gconstpointer a, gconstpointer b)
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)
void add_hash_param(GHashTable *hash, const char *name, const char *value)
#define pe_set_action_bit(action, bit)
GListPtr find_actions(GListPtr input, const char *key, const node_t *on_node)
#define crm_err(fmt, args...)
crm_time_t * crm_time_new(const char *string)
#define pe_clear_action_bit(action, bit)
op_digest_cache_t * rsc_action_digest_cmp(resource_t *rsc, xmlNode *xml_op, node_t *node, pe_working_set_t *data_set)
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)
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
#define pe_flag_have_quorum
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)
action_t * get_pseudo_op(const char *name, pe_working_set_t *data_set)
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.
char * crm_itoa(int an_int)
#define pe_rsc_needs_fencing
#define safe_str_eq(a, b)
char * crm_strdup_printf(char const *format,...) __attribute__((__format__(__printf__
gint sort_rsc_priority(gconstpointer a, gconstpointer b)
void print_node(const char *pre_text, node_t *node, gboolean details)
#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)
GListPtr node_list_dup(GListPtr list1, gboolean reset, gboolean filter)
char * score2char_stack(int score, char *buf, size_t len)
#define crm_time_log_date
#define XML_ATTR_RA_VERSION
#define XML_TAG_OP_VER_ATTRS
#define pe_flag_stonith_enabled
void clear_bit_recursive(resource_t *rsc, unsigned long long flag)
#define pe_warn_once(pe_wo_bit, fmt...)
#define XML_AGENT_ATTR_CLASS
#define CRMD_ACTION_STATUS
void crm_time_free(crm_time_t *dt)