24 extern xmlNode *
get_object_root(
const char *object_type, xmlNode * the_root);
25 void print_str_str(gpointer key, gpointer value, gpointer user_data);
29 static xmlNode *find_rsc_op_entry_helper(
resource_t * rsc,
const char *key,
30 gboolean include_disabled);
32 #if ENABLE_VERSIONED_ATTRS
33 pe_rsc_action_details_t *
36 pe_rsc_action_details_t *details;
41 action->
action_details = calloc(1,
sizeof(pe_rsc_action_details_t));
46 if (details->versioned_parameters == NULL) {
50 if (details->versioned_meta == NULL) {
59 pe_rsc_action_details_t *details;
67 if (details->versioned_parameters) {
68 free_xml(details->versioned_parameters);
70 if (details->versioned_meta) {
105 }
else if(node == NULL) {
122 CRM_CHECK(this_node != NULL,
return NULL);
124 new_node = calloc(1,
sizeof(
node_t));
141 GHashTable *result = hash;
142 node_t *other_node = NULL;
148 g_hash_table_iter_init(&iter, hash);
149 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
152 if (other_node == NULL) {
154 }
else if (merge_scores) {
159 for (; gIter != NULL; gIter = gIter->next) {
162 other_node = pe_hash_table_lookup(result, node->
details->
id);
164 if (other_node == NULL) {
168 g_hash_table_insert(result, (gpointer) new_node->
details->
id, new_node);
177 GHashTable *result = g_hash_table_new_full(
crm_str_hash, g_str_equal, NULL,
180 for (; gIter != NULL; gIter = gIter->next) {
184 g_hash_table_insert(result, (gpointer) n->details->id, n);
196 for (; gIter != NULL; gIter = gIter->next) {
200 if (filter && this_node->
weight < 0) {
208 if (new_node != NULL) {
209 result = g_list_prepend(result, new_node);
219 const char *name_a = ((
const node_t *) a)->details->uname;
220 const char *name_b = ((
const node_t *) b)->details->uname;
222 while (*name_a && *name_b) {
223 if (isdigit(*name_a) && isdigit(*name_b)) {
228 long num_a = strtol(name_a, &end_a, 10);
229 long num_b = strtol(name_b, &end_b, 10);
232 size_t len_a = end_a - name_a;
233 size_t len_b = end_b - name_b;
237 }
else if (num_a > num_b) {
239 }
else if (len_a < len_b) {
241 }
else if (len_a > len_b) {
248 int lower_a = tolower(*name_a);
249 int lower_b = tolower(*name_b);
251 if (lower_a < lower_b) {
253 }
else if (lower_a > lower_b) {
260 if (!*name_a && *name_b) {
262 }
else if (*name_a && !*name_b) {
270 resource_t * rsc,
const char *comment, GHashTable * nodes)
272 GHashTable *hash = nodes;
287 int len =
sizeof(score);
290 GListPtr list = g_hash_table_get_values(hash);
295 for (; gIter != NULL; gIter = gIter->next) {
301 printf(
"%s: %s allocation score on %s: %s\n",
304 printf(
"%s: %s = %s\n", comment, node->
details->
uname, score);
312 int len =
sizeof(score);
313 g_hash_table_iter_init(&iter, hash);
314 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
320 "%s: %s allocation score on %s: %s", comment, rsc->
id,
333 for (; gIter != NULL; gIter = gIter->next) {
342 append_dump_text(gpointer key, gpointer value, gpointer user_data)
344 char **dump_text = user_data;
346 *dump_text, (
char *)key, (
char *)value);
349 *dump_text = new_text;
361 fprintf(stdout,
"%s\n", dump_text);
375 g_hash_table_foreach(rsc->
utilization, append_dump_text, &dump_text);
378 fprintf(stdout,
"%s\n", dump_text);
392 if (a == NULL && b == NULL) {
419 if (a == NULL && b == NULL) {
442 node_t * on_node, gboolean optional, gboolean save_action,
449 CRM_CHECK(task != NULL, free(key);
return NULL);
451 if (save_action && rsc != NULL) {
453 }
else if(save_action) {
455 action = g_hash_table_lookup(data_set->
singletons, key);
466 if (possible_matches != NULL) {
467 if (g_list_length(possible_matches) > 1) {
468 pe_warn(
"Action %s for %s on %s exists %d times",
469 task, rsc ? rsc->
id :
"<NULL>",
470 on_node ? on_node->
details->
uname :
"<NULL>", g_list_length(possible_matches));
473 action = g_list_nth_data(possible_matches, 0);
474 pe_rsc_trace(rsc,
"Found existing action %d (%s) for %s (%s) on %s",
476 (rsc? rsc->
id :
"no resource"), task,
478 g_list_free(possible_matches);
481 if (action == NULL) {
483 pe_rsc_trace(rsc,
"Creating %s action %d: %s for %s (%s) on %s",
484 (optional?
"optional" :
" mandatory"),
486 (rsc? rsc->
id :
"no resource"), task,
490 action = calloc(1,
sizeof(
action_t));
498 action->
task = strdup(task);
502 action->
uuid = strdup(key);
511 action->
extra = crm_str_table_new();
512 action->
meta = crm_str_table_new();
522 action->
op_entry = find_rsc_op_entry_helper(rsc, key, TRUE);
546 warn_level = LOG_WARNING;
554 action->
extra, NULL, FALSE, data_set->
now);
560 }
else if (action->
node == NULL) {
565 && g_hash_table_lookup(action->
meta,
576 do_crm_log(warn_level,
"Action %s on %s is unrunnable (offline)",
579 && save_action && a_task ==
stop_rsc
586 do_crm_log(warn_level,
"Action %s on %s is unrunnable (pending)",
600 action->runnable = TRUE;
644 unpack_operation_on_fail(
action_t * action)
654 xmlNode *operation = NULL;
655 const char *name = NULL;
656 const char *role = NULL;
657 const char *on_fail = NULL;
658 const char *interval_spec = NULL;
659 const char *enabled = NULL;
663 for (operation = __xml_first_child(action->
rsc->
ops_xml);
664 operation && !value; operation = __xml_next_element(operation)) {
666 if (!
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
692 find_min_interval_mon(
resource_t * rsc, gboolean include_disabled)
694 guint interval_ms = 0;
695 guint min_interval_ms = G_MAXUINT;
696 const char *name = NULL;
697 const char *value = NULL;
698 const char *interval_spec = NULL;
700 xmlNode *operation = NULL;
702 for (operation = __xml_first_child(rsc->
ops_xml); operation != NULL;
703 operation = __xml_next_element(operation)) {
705 if (
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
709 if (!include_disabled && value &&
crm_is_true(value) == FALSE) {
719 if (interval_ms && (interval_ms < min_interval_ms)) {
720 min_interval_ms = interval_ms;
730 unpack_start_delay(
const char *value, GHashTable *meta)
737 if (start_delay < 0) {
750 unpack_interval_origin(
const char *value, GHashTable *meta, xmlNode *xml_obj,
755 if ((interval_ms > 0) && (value != NULL)) {
761 long long delay_s = 0;
762 int interval_sec = interval_ms / 1000;
764 crm_trace(
"Origin: %s, interval: %d", value, interval_sec);
792 start_delay = delay_s * 1000;
795 crm_info(
"Calculated a start delay of %llds for %s", delay_s,
ID(xml_obj));
800 crm_itoa(start_delay));
805 }
else if (!origin && xml_obj) {
815 unpack_timeout(
const char *value)
828 xmlNode *child = NULL;
829 const char *timeout = NULL;
841 GHashTable *action_meta = crm_str_table_new();
843 NULL, action_meta, NULL, FALSE, data_set->
now);
851 if (timeout_ms < 0) {
857 #if ENABLE_VERSIONED_ATTRS
859 unpack_versioned_meta(xmlNode *versioned_meta, xmlNode *xml_obj,
862 xmlNode *attrs = NULL;
863 xmlNode *attr = NULL;
865 for (attrs = __xml_first_child(versioned_meta); attrs != NULL; attrs = __xml_next_element(attrs)) {
866 for (attr = __xml_first_child(attrs); attr != NULL; attr = __xml_next_element(attr)) {
871 int start_delay = unpack_start_delay(value, NULL);
875 int start_delay = unpack_interval_origin(value, NULL, xml_obj,
881 int timeout = unpack_timeout(value);
906 guint interval_ms = 0;
908 char *value_ms = NULL;
909 const char *value = NULL;
910 const char *field = NULL;
911 char *default_timeout = NULL;
912 #if ENABLE_VERSIONED_ATTRS
913 pe_rsc_action_details_t *rsc_details = NULL;
920 action->
meta, NULL, FALSE, data_set->
now);
924 if (default_timeout) {
925 default_timeout = strdup(default_timeout);
930 xmlAttrPtr xIter = NULL;
934 NULL, action->
meta, NULL, TRUE,
937 #if ENABLE_VERSIONED_ATTRS
938 rsc_details = pe_rsc_action_details(action);
939 pe_unpack_versioned_attributes(data_set->
input, xml_obj,
941 rsc_details->versioned_parameters,
943 pe_unpack_versioned_attributes(data_set->
input, xml_obj,
945 rsc_details->versioned_meta,
952 for (xIter = xml_obj->properties; xIter; xIter = xIter->next) {
953 const char *prop_name = (
const char *)xIter->name;
956 g_hash_table_replace(action->
meta, strdup(prop_name), strdup(prop_value));
960 g_hash_table_remove(action->
meta,
"id");
964 value = g_hash_table_lookup(action->
meta, field);
968 }
else if ((xml_obj == NULL) && !strcmp(action->
task,
RSC_STATUS)) {
975 if (interval_ms > 0) {
977 g_hash_table_replace(action->
meta, strdup(field), value_ms);
980 g_hash_table_remove(action->
meta, field);
985 free(default_timeout);
991 xmlNode *min_interval_mon = find_min_interval_mon(action->
rsc, FALSE);
993 if (min_interval_mon) {
996 crm_trace(
"\t%s defaults to minimum-interval monitor's timeout '%s'",
997 action->
uuid, value);
998 free(default_timeout);
999 default_timeout = strdup(value);
1004 if (default_timeout) {
1013 value =
"nothing (not start/promote)";
1017 value =
"fencing (resource)";
1021 value =
"quorum (resource)";
1025 value =
"nothing (resource)";
1030 value = unpack_operation_on_fail(action);
1032 if (value == NULL) {
1041 value =
"node fencing";
1044 crm_config_err(
"Specifying on_fail=fence and" " stonith-enabled=false makes no sense");
1047 value =
"stop resource";
1052 value =
"node standby";
1061 value =
"force migration";
1066 value =
"stop resource";
1070 value =
"restart (and possibly migrate)";
1072 }
else if (
safe_str_eq(value,
"restart-container")) {
1075 value =
"restart container (and possibly migrate)";
1082 pe_err(
"Resource %s: Unknown failure type (%s)", action->
rsc->
id, value);
1087 if (value == NULL && container) {
1089 value =
"restart container (and possibly migrate) (default)";
1107 value =
"stop unmanaged remote node (enforcing default)";
1111 value =
"fence remote node (default)";
1113 value =
"recover remote node connection (default)";
1125 value =
"resource fence (default)";
1129 value =
"resource block (default)";
1132 }
else if (value == NULL) {
1134 value =
"restart (and possibly migrate) (default)";
1140 if (xml_obj != NULL) {
1141 value = g_hash_table_lookup(action->
meta,
"role_after_failure");
1144 "Support for role_after_failure is deprecated and will be removed in a future release");
1163 unpack_start_delay(value, action->
meta);
1166 unpack_interval_origin(value, action->
meta, xml_obj, interval_ms,
1171 timeout = unpack_timeout(value);
1174 #if ENABLE_VERSIONED_ATTRS
1175 unpack_versioned_meta(rsc_details->versioned_meta, xml_obj, interval_ms,
1181 find_rsc_op_entry_helper(
resource_t * rsc,
const char *key, gboolean include_disabled)
1183 guint interval_ms = 0;
1184 gboolean do_retry = TRUE;
1185 char *local_key = NULL;
1186 const char *name = NULL;
1187 const char *value = NULL;
1188 const char *interval_spec = NULL;
1189 char *match_key = NULL;
1191 xmlNode *operation = NULL;
1194 for (operation = __xml_first_child(rsc->
ops_xml); operation != NULL;
1195 operation = __xml_next_element(operation)) {
1196 if (
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
1200 if (!include_disabled && value &&
crm_is_true(value) == FALSE) {
1227 if (do_retry == FALSE) {
1237 }
else if (strstr(key,
"_notify_")) {
1249 return find_rsc_op_entry_helper(rsc, key, FALSE);
1256 crm_trace(
"%s%s: <NULL>", pre_text == NULL ?
"" : pre_text, pre_text == NULL ?
"" :
": ");
1261 crm_trace(
"%s%s%sNode %s: (weight=%d, fixed=%s)",
1262 pre_text == NULL ?
"" : pre_text,
1263 pre_text == NULL ?
"" :
": ",
1268 char *pe_mutable = strdup(
"\t\t");
1277 for (; gIter != NULL; gIter = gIter->next) {
1292 user_data == NULL ?
"" : (
char *)user_data,
1293 user_data == NULL ?
"" :
": ", (
char *)key, (
char *)value);
1303 pre_text == NULL ?
"" : pre_text, pre_text == NULL ?
"" :
": ");
1309 rsc->
fns->
print(rsc, pre_text, options, &log_level);
1315 if (action == NULL) {
1320 if (action->
extra) {
1321 g_hash_table_destroy(action->
extra);
1324 g_hash_table_destroy(action->
meta);
1326 #if ENABLE_VERSIONED_ATTRS
1328 pe_free_rsc_action_details(action);
1342 const char *value = NULL;
1348 for (; gIter != NULL; gIter = gIter->next) {
1352 if (value == NULL) {
1358 }
else if (not_on_node == NULL) {
1360 result = g_list_prepend(result, action);
1362 }
else if (action->
node == NULL) {
1366 result = g_list_prepend(result, action);
1387 crm_trace(
"Folding %s back into its atomic counterpart for %s", name, rsc->
id);
1404 for (gIter = input; gIter != NULL; gIter = gIter->next) {
1413 }
else if (on_node == NULL) {
1416 }
else if (action->
node == NULL) {
1435 for (; gIter != NULL; gIter = gIter->next) {
1439 crm_trace(
"%s does not match action %s", key, action->
uuid);
1442 }
else if (on_node == NULL) {
1443 crm_trace(
"Action %s matches (ignoring node)", key);
1444 result = g_list_prepend(result, action);
1446 }
else if (action->
node == NULL) {
1447 crm_trace(
"Action %s matches (unallocated, assigning to %s)",
1451 result = g_list_prepend(result, action);
1455 result = g_list_prepend(result, action);
1458 crm_trace(
"Action %s on node %s does not match requested node %s",
1470 GList *result = NULL;
1474 if (on_node == NULL) {
1475 crm_trace(
"Not searching for action %s because node not specified",
1480 for (GList *gIter = input; gIter != NULL; gIter = gIter->next) {
1483 if (action->
node == NULL) {
1484 crm_trace(
"Skipping comparison of %s vs action %s without node",
1488 crm_trace(
"Desired action %s doesn't match %s", key, action->
uuid);
1492 crm_trace(
"Action %s desired node ID %s doesn't match %s",
1497 result = g_list_prepend(result, action);
1518 const char *task,
bool require_node)
1520 GList *result = NULL;
1533 resource_node_score(
resource_t * rsc,
node_t * node,
int score,
const char *tag)
1548 for (; gIter != NULL; gIter = gIter->next) {
1551 resource_node_score(child_rsc, node, score, tag);
1557 if (match == NULL) {
1569 resource_node_score(rsc, node, score, tag);
1571 }
else if (data_set != NULL) {
1574 for (; gIter != NULL; gIter = gIter->next) {
1577 resource_node_score(rsc, node_iter, score, tag);
1581 GHashTableIter iter;
1582 node_t *node_iter = NULL;
1585 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node_iter)) {
1586 resource_node_score(rsc, node_iter, score, tag);
1590 if (node == NULL && score == -
INFINITY) {
1599 #define sort_return(an_int, why) do { \
1602 crm_trace("%s (%d) %c %s (%d) : %s", \
1603 a_xml_id, a_call_id, an_int>0?'>':an_int<0?'<':'=', \
1604 b_xml_id, b_call_id, why); \
1614 char *a_uuid = NULL;
1615 char *b_uuid = NULL;
1617 const xmlNode *xml_a = a;
1618 const xmlNode *xml_b = b;
1629 pe_err(
"Duplicate lrm_rsc_op entries named %s", a_xml_id);
1636 if (a_call_id == -1 && b_call_id == -1) {
1642 }
else if (a_call_id >= 0 && a_call_id < b_call_id) {
1645 }
else if (b_call_id >= 0 && a_call_id > b_call_id) {
1648 }
else if (b_call_id >= 0 && a_call_id == b_call_id) {
1659 crm_trace(
"rc-change: %d vs %d", last_a, last_b);
1660 if (last_a >= 0 && last_a < last_b) {
1663 }
else if (last_b >= 0 && last_a > last_b) {
1704 if (b_call_id == -1) {
1707 }
else if (a_call_id == -1) {
1711 }
else if ((a_id >= 0 && a_id < b_id) || b_id == -1) {
1714 }
else if ((b_id >= 0 && a_id > b_id) || a_id == -1) {
1728 if (data_set->
now == NULL) {
1747 if (value == NULL ||
safe_str_eq(
"started", value)
1765 crm_config_err(
"%s is not part of a promotable clone resource, a %s of '%s' makes no sense",
1786 if (lh_action == NULL || rh_action == NULL) {
1797 for (; gIter != NULL; gIter = gIter->next) {
1800 if (after->
action == rh_action && (after->
type & order)) {
1806 wrapper->
action = rh_action;
1807 wrapper->
type = order;
1810 list = g_list_prepend(list, wrapper);
1819 wrapper->
action = lh_action;
1820 wrapper->
type = order;
1822 list = g_list_prepend(list, wrapper);
1833 op = g_hash_table_lookup(data_set->
singletons, name);
1836 op =
custom_action(NULL, strdup(name), name, NULL, TRUE, TRUE, data_set);
1849 if (ticket->
state) {
1850 g_hash_table_destroy(ticket->
state);
1861 if (ticket_id == NULL || strlen(ticket_id) == 0) {
1865 if (data_set->
tickets == NULL) {
1871 ticket = g_hash_table_lookup(data_set->
tickets, ticket_id);
1872 if (ticket == NULL) {
1874 ticket = calloc(1,
sizeof(
ticket_t));
1875 if (ticket == NULL) {
1876 crm_err(
"Cannot allocate ticket '%s'", ticket_id);
1880 crm_trace(
"Creaing ticket entry for %s", ticket_id);
1882 ticket->
id = strdup(ticket_id);
1886 ticket->
state = crm_str_table_new();
1888 g_hash_table_insert(data_set->
tickets, strdup(ticket->
id), ticket);
1895 filter_parameters(xmlNode * param_set,
const char *param_string,
bool need_present)
1897 if (param_set && param_string) {
1898 xmlAttrPtr xIter = param_set->properties;
1901 const char *prop_name = (
const char *)xIter->name;
1903 char *match = strstr(param_string, name);
1908 xIter = xIter->next;
1910 if (need_present && match == NULL) {
1911 crm_trace(
"%s not found in %s", prop_name, param_string);
1914 }
else if (need_present == FALSE && match) {
1915 crm_trace(
"%s found in %s", prop_name, param_string);
1922 #if ENABLE_VERSIONED_ATTRS
1924 append_versioned_params(xmlNode *versioned_params,
const char *ra_version, xmlNode *params)
1926 GHashTable *hash = pe_unpack_versioned_parameters(versioned_params, ra_version);
1929 GHashTableIter iter;
1931 g_hash_table_iter_init(&iter, hash);
1932 while (g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &value)) {
1935 g_hash_table_destroy(hash);
1940 rsc_action_digest(
resource_t * rsc,
const char *task,
const char *key,
1947 GHashTable *local_rsc_params = crm_str_table_new();
1949 #if ENABLE_VERSIONED_ATTRS
1951 const char *ra_version = NULL;
1954 const char *op_version;
1955 const char *restart_list = NULL;
1956 const char *secure_list =
" passwd password ";
1962 #if ENABLE_VERSIONED_ATTRS
1963 pe_get_versioned_attributes(local_versioned_params, rsc, node, data_set);
1971 crm_trace(
"Set address for bundle connection %s (on %s)",
1985 #if ENABLE_VERSIONED_ATTRS
1993 #if ENABLE_VERSIONED_ATTRS
1994 append_versioned_params(local_versioned_params, ra_version, data->
params_all);
1995 append_versioned_params(rsc->versioned_parameters, ra_version, data->
params_all);
1998 pe_rsc_action_details_t *details = pe_rsc_action_details(action);
1999 append_versioned_params(details->versioned_parameters, ra_version, data->
params_all);
2005 g_hash_table_destroy(local_rsc_params);
2039 guint interval_ms = 0;
2041 const char *op_version;
2045 const char *digest_all;
2046 const char *digest_restart;
2056 data = rsc_action_digest(rsc, task, key, node, xml_op, data_set);
2060 pe_rsc_info(rsc,
"Parameters to %s on %s changed: was %s vs. now %s (restart:%s) %s",
2066 }
else if (digest_all == NULL) {
2071 pe_rsc_info(rsc,
"Parameters to %s on %s changed: was %s vs. now %s (%s:%s) %s",
2074 (interval_ms > 0)?
"reschedule" :
"reload",
2083 #define STONITH_DIGEST_TASK "stonith-on"
2103 if (digest_all == NULL) {
2107 }
else if (strstr(digest_all, search_all)) {
2111 if(strstr(digest_secure, search_secure)) {
2113 printf(
"Only 'private' parameters to %s for unfencing %s changed\n",
2124 printf(
"Parameters to %s for unfencing %s changed, try '%s:%s:%s'\n",
2132 free(search_secure);
2140 return ID(rsc->
xml);
2151 for (; gIter != NULL; gIter = gIter->next) {
2164 for (; gIter != NULL; gIter = gIter->next) {
2174 for (
GListPtr gIter = candidates; gIter != NULL; gIter = gIter->next) {
2180 matches = find_unfencing_devices(candidate->
children, matches);
2184 }
else if (
crm_str_eq(provides,
"unfencing", FALSE) ||
crm_str_eq(requires,
"unfencing", FALSE)) {
2185 matches = g_list_prepend(matches, candidate);
2195 char *op_key = NULL;
2205 stonith_op = g_hash_table_lookup(data_set->
singletons, op_key);
2208 if(stonith_op == NULL) {
2226 long digests_all_offset = 0;
2227 long digests_secure_offset = 0;
2229 char *digests_all = malloc(max);
2230 char *digests_secure = malloc(max);
2233 for (
GListPtr gIter = matches; gIter != NULL; gIter = gIter->next) {
2241 fprintf(stdout,
" notice: Unfencing %s (remote): because the definition of %s changed\n", node->
details->
uname, match->
id);
2245 digests_all_offset += snprintf(
2246 digests_all+digests_all_offset, max-digests_all_offset,
2249 digests_secure_offset += snprintf(
2250 digests_secure+digests_secure_offset, max-digests_secure_offset,
2253 g_hash_table_insert(stonith_op->
meta,
2256 g_hash_table_insert(stonith_op->
meta,
2265 if(optional == FALSE &&
pe_can_fence(data_set, node)) {
2267 }
else if(reason && stonith_op->
reason == NULL) {
2268 stonith_op->
reason = strdup(reason);
2297 GHashTableIter iter;
2300 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
2309 add_tag_ref(GHashTable * tags,
const char * tag_name,
const char * obj_ref)
2313 gboolean is_existing = FALSE;
2315 CRM_CHECK(tags && tag_name && obj_ref,
return FALSE);
2317 tag = g_hash_table_lookup(tags, tag_name);
2319 tag = calloc(1,
sizeof(
tag_t));
2323 tag->
id = strdup(tag_name);
2325 g_hash_table_insert(tags, strdup(tag_name), tag);
2328 for (gIter = tag->
refs; gIter != NULL; gIter = gIter->next) {
2329 const char *existing_ref = (
const char *) gIter->data;
2331 if (
crm_str_eq(existing_ref, obj_ref, TRUE)){
2337 if (is_existing == FALSE) {
2338 tag->
refs = g_list_append(tag->
refs, strdup(obj_ref));
2339 crm_trace(
"Added: tag=%s ref=%s", tag->
id, obj_ref);
2350 bool update = FALSE;
2351 const char *change = NULL;
2355 change =
"unrunnable";
2358 change =
"required";
2362 change =
"unrunnable";
2364 change =
"dangling";
2366 change =
"required";
2368 crm_err(
"Unknown flag change to %x by %s: 0x%s",
2369 flags, action->
uuid, (reason? reason->
uuid :
"0"));
2373 if(is_set(action->
flags, flags)) {
2374 action->
flags = crm_clear_bit(
function, line, action->
uuid, action->
flags, flags);
2379 if(is_not_set(action->
flags, flags)) {
2380 action->
flags = crm_set_bit(
function, line, action->
uuid, action->
flags, flags);
2385 if((change && update) || text) {
2386 char *reason_text = NULL;
2387 if(reason == NULL) {
2390 }
else if(reason->
rsc == NULL) {
2396 if(reason_text && action->
rsc != reason->
rsc) {
2405 if(action->
reason && overwrite) {
2410 if(action->
reason == NULL) {
2413 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
enum pe_quorum_policy no_quorum_policy
gboolean parse_op_key(const char *key, char **rsc_id, char **op_type, guint *interval_ms)
#define crm_notice(fmt, args...)
#define CRMD_ACTION_MIGRATED
void dump_rsc_utilization(int level, const char *comment, resource_t *rsc, node_t *node)
#define pe_rsc_debug(rsc, fmt, args...)
void crm_time_add_seconds(crm_time_t *dt, int value)
gboolean safe_str_neq(const char *a, const char *b)
gint sort_rsc_priority(gconstpointer a, gconstpointer b)
#define XML_OP_ATTR_DIGESTS_ALL
gint sort_rsc_index(gconstpointer a, gconstpointer b)
void hash2field(gpointer key, gpointer value, gpointer user_data)
Set XML attribute based on hash table entry.
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)
GListPtr node_list_dup(GListPtr list, gboolean reset, gboolean filter)
#define crm_time_log_timeofday
pe_resource_t * container
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)
xmlNode * first_named_child(const xmlNode *parent, const char *name)
#define pe_action_required(action, reason, text)
enum rsc_role_e next_role
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
const char * crm_xml_add_int(xmlNode *node, const char *name, int value)
Create an XML attribute with specified name and integer value.
gboolean exclusive_discover
long long crm_get_msec(const char *input)
GListPtr find_actions(GListPtr input, const char *key, const node_t *on_node)
char * score2char_stack(int score, char *buf, size_t len)
resource_object_functions_t * fns
#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)
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
#define XML_LRM_ATTR_OP_DIGEST
#define CRMD_ACTION_PROMOTE
gboolean pe__is_guest_or_remote_node(pe_node_t *node)
#define XML_LRM_ATTR_OP_RESTART
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)
#define do_crm_log_alias(level, file, function, line, fmt, args...)
Log a message as if it came from a different code location.
void set_bit_recursive(resource_t *rsc, unsigned long long flag)
#define clear_bit(word, bit)
guint crm_parse_interval_spec(const char *input)
#define XML_RSC_ATTR_PROVIDES
action_t * get_pseudo_op(const char *name, pe_working_set_t *data_set)
#define XML_OP_ATTR_ON_FAIL
int crm_element_value_int(const xmlNode *data, const char *name, int *dest)
Retrieve the integer value of an XML attribute.
#define pe_flag_have_quorum
GListPtr find_recurring_actions(GListPtr input, node_t *not_on_node)
gboolean remote_requires_reset
#define XML_RSC_ATTR_REMOTE_RA_ADDR
#define crm_time_log_duration
pe_node_t * pe_find_node_id(GListPtr node_list, const char *id)
#define XML_LRM_ATTR_OP_SECURE
#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)
char * calculate_operation_digest(xmlNode *local_cib, const char *version)
Calculate and return digest of XML operation.
guint remote_reconnect_ms
#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
gboolean pe__is_guest_node(pe_node_t *node)
#define crm_debug(fmt, args...)
pe_resource_t * uber_parent(pe_resource_t *rsc)
#define pe_flag_sanitized
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
crm_time_t * crm_time_calculate_duration(crm_time_t *dt, crm_time_t *value)
#define sort_return(an_int, why)
const char * pe__add_bundle_remote_name(pe_resource_t *rsc, xmlNode *xml, const char *field)
#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
const char * stonith_action
struct pe_node_shared_s * details
#define XML_TAG_OP_VER_META
#define pe_rsc_needs_fencing
#define pe_rsc_promotable
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.
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)
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 pe_flag_stonith_enabled
#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 * 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)
Unpack operation XML into an action structure.
#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)
enum pe_obj_types variant
gboolean crm_str_eq(const char *a, const char *b, gboolean use_case)
void(* print)(pe_resource_t *, const char *, long, void *)
#define XML_LRM_ATTR_TARGET_UUID
#define pe_rsc_fence_device
long long int crm_time_get_seconds(crm_time_t *dt)
GHashTable * node_hash_from_list(GListPtr list)
guint crm_parse_ms(const char *text)
void get_rsc_attributes(GHashTable *meta_hash, pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set)
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)
const char * rsc_printable_id(pe_resource_t *rsc)
ticket_t * ticket_new(const char *ticket_id, pe_working_set_t *data_set)
crm_time_t * crm_time_new(const char *string)
gboolean pe__resource_is_remote_conn(pe_resource_t *rsc, pe_working_set_t *data_set)
#define pe_clear_action_bit(action, bit)
void xml_remove_prop(xmlNode *obj, const char *name)
void print_str_str(gpointer key, gpointer value, gpointer user_data)
#define XML_LRM_ATTR_INTERVAL_MS
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
void hash2metafield(gpointer key, gpointer value, gpointer user_data)
Set XML attribute based on hash table entry, as meta-attribute name.
enum rsc_role_e fail_role
#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)
Parse a transition magic string into its constituent parts.
enum pe_action_flags flags
GHashTable * digest_cache
cache of calculated resource digests
#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)
void destroy_ticket(gpointer data)
void filter_action_parameters(xmlNode *param_set, const char *version)
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)
#define pe_rsc_needs_quorum
gboolean crm_is_true(const char *s)
#define pe_flag_have_stonith_resource
GList * find_actions_exact(GList *input, const char *key, const pe_node_t *on_node)
#define pe_flag_enable_unfencing
#define XML_LRM_ATTR_TARGET
#define pe_rsc_trace(rsc, fmt, args...)
gboolean(* active)(pe_resource_t *, gboolean)
void print_resource(int log_level, const char *pre_text, resource_t *rsc, gboolean details)
#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)
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.
gint sort_node_uname(gconstpointer a, gconstpointer b)
char * crm_strdup_printf(char const *format,...) __attribute__((__format__(__printf__
#define STONITH_DIGEST_TASK
#define CRMD_ACTION_CANCEL
#define crm_info(fmt, args...)
char * digest_restart_calc
char * generate_op_key(const char *rsc_id, const char *op_type, guint interval_ms)
Generate an operation key.
#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)
#define XML_ATTR_RA_VERSION
#define XML_TAG_OP_VER_ATTRS
#define pe_warn_once(pe_wo_bit, fmt...)
#define pe_rsc_info(rsc, fmt, args...)
GHashTable * allowed_nodes
#define CRMD_ACTION_STATUS
xmlNode * crm_next_same_xml(const xmlNode *sibling)
Get next instance of same XML tag.
void crm_time_free(crm_time_t *dt)