25 extern xmlNode *
get_object_root(
const char *object_type, xmlNode * the_root);
26 void print_str_str(gpointer key, gpointer value, gpointer user_data);
30 static xmlNode *find_rsc_op_entry_helper(
resource_t * rsc,
const char *key,
31 gboolean include_disabled);
33 #if ENABLE_VERSIONED_ATTRS
34 pe_rsc_action_details_t *
37 pe_rsc_action_details_t *details;
42 action->
action_details = calloc(1,
sizeof(pe_rsc_action_details_t));
47 if (details->versioned_parameters == NULL) {
51 if (details->versioned_meta == NULL) {
60 pe_rsc_action_details_t *details;
68 if (details->versioned_parameters) {
69 free_xml(details->versioned_parameters);
71 if (details->versioned_meta) {
97 for (GList *n = rsc->
running_on; n != NULL; n = n->next) {
119 }
else if(node == NULL) {
136 CRM_CHECK(this_node != NULL,
return NULL);
138 new_node = calloc(1,
sizeof(
node_t));
155 GHashTable *result = hash;
156 node_t *other_node = NULL;
162 g_hash_table_iter_init(&iter, hash);
163 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
166 if (other_node == NULL) {
168 }
else if (merge_scores) {
173 for (; gIter != NULL; gIter = gIter->next) {
176 other_node = pe_hash_table_lookup(result, node->
details->
id);
178 if (other_node == NULL) {
182 g_hash_table_insert(result, (gpointer) new_node->
details->
id, new_node);
191 GHashTable *result = g_hash_table_new_full(
crm_str_hash, g_str_equal, NULL,
194 for (; gIter != NULL; gIter = gIter->next) {
198 g_hash_table_insert(result, (gpointer) n->details->id, n);
210 for (; gIter != NULL; gIter = gIter->next) {
214 if (filter && this_node->
weight < 0) {
222 if (new_node != NULL) {
223 result = g_list_prepend(result, new_node);
233 const char *name_a = ((
const node_t *) a)->details->uname;
234 const char *name_b = ((
const node_t *) b)->details->uname;
236 while (*name_a && *name_b) {
237 if (isdigit(*name_a) && isdigit(*name_b)) {
242 long num_a = strtol(name_a, &end_a, 10);
243 long num_b = strtol(name_b, &end_b, 10);
246 size_t len_a = end_a - name_a;
247 size_t len_b = end_b - name_b;
251 }
else if (num_a > num_b) {
253 }
else if (len_a < len_b) {
255 }
else if (len_a > len_b) {
262 int lower_a = tolower(*name_a);
263 int lower_b = tolower(*name_b);
265 if (lower_a < lower_b) {
267 }
else if (lower_a > lower_b) {
274 if (!*name_a && *name_b) {
276 }
else if (*name_a && !*name_b) {
284 resource_t * rsc,
const char *comment, GHashTable * nodes)
286 GHashTable *hash = nodes;
301 int len =
sizeof(score);
304 GListPtr list = g_hash_table_get_values(hash);
309 for (; gIter != NULL; gIter = gIter->next) {
315 printf(
"%s: %s allocation score on %s: %s\n",
318 printf(
"%s: %s = %s\n", comment, node->
details->
uname, score);
326 int len =
sizeof(score);
327 g_hash_table_iter_init(&iter, hash);
328 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
334 "%s: %s allocation score on %s: %s", comment, rsc->
id,
335 node->details->uname, score);
338 node->details->uname, score);
347 for (; gIter != NULL; gIter = gIter->next) {
356 append_dump_text(gpointer key, gpointer value, gpointer user_data)
358 char **dump_text = user_data;
360 *dump_text, (
char *)key, (
char *)value);
363 *dump_text = new_text;
375 fprintf(stdout,
"%s\n", dump_text);
389 g_hash_table_foreach(rsc->
utilization, append_dump_text, &dump_text);
392 fprintf(stdout,
"%s\n", dump_text);
406 if (a == NULL && b == NULL) {
433 if (a == NULL && b == NULL) {
481 node_t * on_node, gboolean optional, gboolean save_action,
488 CRM_CHECK(task != NULL, free(key);
return NULL);
490 if (save_action && rsc != NULL) {
492 }
else if(save_action) {
494 action = g_hash_table_lookup(data_set->
singletons, key);
505 if (possible_matches != NULL) {
506 if (g_list_length(possible_matches) > 1) {
507 pe_warn(
"Action %s for %s on %s exists %d times",
508 task, rsc ? rsc->
id :
"<NULL>",
509 on_node ? on_node->
details->
uname :
"<NULL>", g_list_length(possible_matches));
512 action = g_list_nth_data(possible_matches, 0);
513 pe_rsc_trace(rsc,
"Found existing action %d (%s) for %s (%s) on %s",
515 (rsc? rsc->
id :
"no resource"), task,
517 g_list_free(possible_matches);
520 if (action == NULL) {
522 pe_rsc_trace(rsc,
"Creating %s action %d: %s for %s (%s) on %s",
523 (optional?
"optional" :
" mandatory"),
525 (rsc? rsc->
id :
"no resource"), task,
529 action = calloc(1,
sizeof(
action_t));
537 action->
task = strdup(task);
541 action->
uuid = strdup(key);
550 action->
extra = crm_str_table_new();
551 action->
meta = crm_str_table_new();
561 action->
op_entry = find_rsc_op_entry_helper(rsc, key, TRUE);
582 enum pe_quorum_policy quorum_policy = effective_quorum_policy(rsc, data_set);
586 warn_level = LOG_WARNING;
594 action->
extra, NULL, FALSE, data_set);
600 }
else if (action->
node == NULL) {
605 && g_hash_table_lookup(action->
meta,
616 do_crm_log(warn_level,
"Action %s on %s is unrunnable (offline)",
619 && save_action && a_task ==
stop_rsc
626 do_crm_log(warn_level,
"Action %s on %s is unrunnable (pending)",
640 crm_debug(
"%s\t%s (cancelled : host cannot be fenced)",
652 action->runnable = TRUE;
694 valid_stop_on_fail(
const char *value)
702 unpack_operation_on_fail(
action_t * action)
705 const char *name = NULL;
706 const char *role = NULL;
707 const char *on_fail = NULL;
708 const char *interval_spec = NULL;
709 const char *enabled = NULL;
713 && !valid_stop_on_fail(value)) {
715 "action to default value because '%s' is not "
716 "allowed for stop", action->
rsc->
id, value);
721 xmlNode *operation = NULL;
725 for (operation = __xml_first_child_element(action->
rsc->
ops_xml);
726 operation && !value; operation = __xml_next_element(operation)) {
728 if (!
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
762 "action to default value because 'demote' is not "
763 "allowed for it", action->
rsc->
id, name);
772 find_min_interval_mon(
resource_t * rsc, gboolean include_disabled)
774 guint interval_ms = 0;
775 guint min_interval_ms = G_MAXUINT;
776 const char *name = NULL;
777 const char *value = NULL;
778 const char *interval_spec = NULL;
780 xmlNode *operation = NULL;
782 for (operation = __xml_first_child_element(rsc->
ops_xml); operation != NULL;
783 operation = __xml_next_element(operation)) {
785 if (
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
789 if (!include_disabled && value &&
crm_is_true(value) == FALSE) {
799 if (interval_ms && (interval_ms < min_interval_ms)) {
800 min_interval_ms = interval_ms;
810 unpack_start_delay(
const char *value, GHashTable *meta)
817 if (start_delay < 0) {
831 unpack_interval_origin(
const char *value, xmlNode *xml_obj, guint interval_ms,
834 long long result = 0;
835 guint interval_sec = interval_ms / 1000;
839 if ((value == NULL) || (interval_ms == 0) || (now == NULL)) {
845 if (origin == NULL) {
848 (
ID(xml_obj)?
ID(xml_obj) :
"(unspecified)"), value);
857 result = result % interval_sec;
860 result = ((result <= 0)? 0 : interval_sec) - result;
861 crm_info(
"Calculated a start delay of %llds for operation '%s'",
863 (
ID(xml_obj)?
ID(xml_obj) :
"(unspecified)"));
865 if (start_delay != NULL) {
866 *start_delay = result * 1000;
872 unpack_timeout(
const char *value)
885 xmlNode *child = NULL;
886 const char *timeout = NULL;
898 GHashTable *action_meta = crm_str_table_new();
900 NULL, action_meta, NULL, FALSE, data_set);
908 if (timeout_ms < 0) {
914 #if ENABLE_VERSIONED_ATTRS
916 unpack_versioned_meta(xmlNode *versioned_meta, xmlNode *xml_obj,
919 xmlNode *attrs = NULL;
920 xmlNode *attr = NULL;
922 for (attrs = __xml_first_child_element(versioned_meta); attrs != NULL;
923 attrs = __xml_next_element(attrs)) {
925 for (attr = __xml_first_child_element(attrs); attr != NULL;
926 attr = __xml_next_element(attr)) {
932 int start_delay = unpack_start_delay(value, NULL);
936 long long start_delay = 0;
938 if (unpack_interval_origin(value, xml_obj, interval_ms, now,
945 int timeout = unpack_timeout(value);
970 guint interval_ms = 0;
972 char *value_ms = NULL;
973 const char *value = NULL;
974 const char *field = NULL;
975 char *default_timeout = NULL;
976 #if ENABLE_VERSIONED_ATTRS
977 pe_rsc_action_details_t *rsc_details = NULL;
984 action->
meta, NULL, FALSE, data_set);
988 if (default_timeout) {
989 default_timeout = strdup(default_timeout);
994 xmlAttrPtr xIter = NULL;
998 action->
meta, NULL, TRUE, data_set);
1000 #if ENABLE_VERSIONED_ATTRS
1001 rsc_details = pe_rsc_action_details(action);
1002 pe_unpack_versioned_attributes(data_set->
input, xml_obj,
1004 rsc_details->versioned_parameters,
1005 data_set->
now, NULL);
1006 pe_unpack_versioned_attributes(data_set->
input, xml_obj,
1008 rsc_details->versioned_meta,
1009 data_set->
now, NULL);
1015 for (xIter = xml_obj->properties; xIter; xIter = xIter->next) {
1016 const char *prop_name = (
const char *)xIter->name;
1019 g_hash_table_replace(action->
meta, strdup(prop_name), strdup(prop_value));
1023 g_hash_table_remove(action->
meta,
"id");
1027 value = g_hash_table_lookup(action->
meta, field);
1028 if (value != NULL) {
1031 }
else if ((xml_obj == NULL) && !strcmp(action->
task,
RSC_STATUS)) {
1038 if (interval_ms > 0) {
1040 g_hash_table_replace(action->
meta, strdup(field), value_ms);
1043 g_hash_table_remove(action->
meta, field);
1048 free(default_timeout);
1054 xmlNode *min_interval_mon = find_min_interval_mon(action->
rsc, FALSE);
1056 if (min_interval_mon) {
1059 crm_trace(
"\t%s defaults to minimum-interval monitor's timeout '%s'",
1060 action->
uuid, value);
1061 free(default_timeout);
1062 default_timeout = strdup(value);
1067 if (default_timeout) {
1076 value =
"nothing (not start/promote)";
1080 value =
"fencing (resource)";
1084 value =
"quorum (resource)";
1088 value =
"nothing (resource)";
1093 value = unpack_operation_on_fail(action);
1095 if (value == NULL) {
1104 value =
"node fencing";
1107 crm_config_err(
"Specifying on_fail=fence and" " stonith-enabled=false makes no sense");
1110 value =
"stop resource";
1115 value =
"node standby";
1124 value =
"force migration";
1129 value =
"stop resource";
1133 value =
"restart (and possibly migrate)";
1135 }
else if (
safe_str_eq(value,
"restart-container")) {
1138 value =
"restart container (and possibly migrate)";
1146 value =
"demote instance";
1149 pe_err(
"Resource %s: Unknown failure type (%s)", action->
rsc->
id, value);
1154 if (value == NULL && container) {
1156 value =
"restart container (and possibly migrate) (default)";
1174 value =
"stop unmanaged remote node (enforcing default)";
1178 value =
"fence remote node (default)";
1180 value =
"recover remote node connection (default)";
1192 value =
"resource fence (default)";
1196 value =
"resource block (default)";
1199 }
else if (value == NULL) {
1201 value =
"restart (and possibly migrate) (default)";
1207 if (xml_obj != NULL) {
1208 value = g_hash_table_lookup(action->
meta,
"role_after_failure");
1211 "Support for role_after_failure is deprecated and will be removed in a future release");
1230 unpack_start_delay(value, action->
meta);
1232 long long start_delay = 0;
1235 if (unpack_interval_origin(value, xml_obj, interval_ms, data_set->
now,
1243 timeout = unpack_timeout(value);
1246 #if ENABLE_VERSIONED_ATTRS
1247 unpack_versioned_meta(rsc_details->versioned_meta, xml_obj, interval_ms,
1253 find_rsc_op_entry_helper(
resource_t * rsc,
const char *key, gboolean include_disabled)
1255 guint interval_ms = 0;
1256 gboolean do_retry = TRUE;
1257 char *local_key = NULL;
1258 const char *name = NULL;
1259 const char *value = NULL;
1260 const char *interval_spec = NULL;
1261 char *match_key = NULL;
1263 xmlNode *operation = NULL;
1266 for (operation = __xml_first_child_element(rsc->
ops_xml); operation != NULL;
1267 operation = __xml_next_element(operation)) {
1268 if (
crm_str_eq((
const char *)operation->name,
"op", TRUE)) {
1272 if (!include_disabled && value &&
crm_is_true(value) == FALSE) {
1299 if (do_retry == FALSE) {
1309 }
else if (strstr(key,
"_notify_")) {
1321 return find_rsc_op_entry_helper(rsc, key, FALSE);
1328 crm_trace(
"%s%s: <NULL>", pre_text == NULL ?
"" : pre_text, pre_text == NULL ?
"" :
": ");
1333 crm_trace(
"%s%s%sNode %s: (weight=%d, fixed=%s)",
1334 pre_text == NULL ?
"" : pre_text,
1335 pre_text == NULL ?
"" :
": ",
1342 char *pe_mutable = strdup(
"\t\t");
1351 for (; gIter != NULL; gIter = gIter->next) {
1367 user_data == NULL ?
"" : (
char *)user_data,
1368 user_data == NULL ?
"" :
": ", (
char *)key, (
char *)value);
1374 if (action == NULL) {
1379 if (action->
extra) {
1380 g_hash_table_destroy(action->
extra);
1383 g_hash_table_destroy(action->
meta);
1385 #if ENABLE_VERSIONED_ATTRS
1387 pe_free_rsc_action_details(action);
1401 const char *value = NULL;
1407 for (; gIter != NULL; gIter = gIter->next) {
1411 if (value == NULL) {
1417 }
else if (not_on_node == NULL) {
1419 result = g_list_prepend(result, action);
1421 }
else if (action->
node == NULL) {
1425 result = g_list_prepend(result, action);
1446 crm_trace(
"Folding %s back into its atomic counterpart for %s", name, rsc->
id);
1463 for (gIter = input; gIter != NULL; gIter = gIter->next) {
1472 }
else if (on_node == NULL) {
1475 }
else if (action->
node == NULL) {
1494 for (; gIter != NULL; gIter = gIter->next) {
1498 crm_trace(
"%s does not match action %s", key, action->
uuid);
1501 }
else if (on_node == NULL) {
1502 crm_trace(
"Action %s matches (ignoring node)", key);
1503 result = g_list_prepend(result, action);
1505 }
else if (action->
node == NULL) {
1506 crm_trace(
"Action %s matches (unallocated, assigning to %s)",
1510 result = g_list_prepend(result, action);
1514 result = g_list_prepend(result, action);
1517 crm_trace(
"Action %s on node %s does not match requested node %s",
1529 GList *result = NULL;
1533 if (on_node == NULL) {
1534 crm_trace(
"Not searching for action %s because node not specified",
1539 for (GList *gIter = input; gIter != NULL; gIter = gIter->next) {
1542 if (action->
node == NULL) {
1543 crm_trace(
"Skipping comparison of %s vs action %s without node",
1547 crm_trace(
"Desired action %s doesn't match %s", key, action->
uuid);
1551 crm_trace(
"Action %s desired node ID %s doesn't match %s",
1556 result = g_list_prepend(result, action);
1577 const char *task,
bool require_node)
1579 GList *result = NULL;
1592 resource_node_score(
resource_t * rsc,
node_t * node,
int score,
const char *tag)
1607 for (; gIter != NULL; gIter = gIter->next) {
1610 resource_node_score(child_rsc, node, score, tag);
1616 if (match == NULL) {
1628 resource_node_score(rsc, node, score, tag);
1630 }
else if (data_set != NULL) {
1633 for (; gIter != NULL; gIter = gIter->next) {
1636 resource_node_score(rsc, node_iter, score, tag);
1640 GHashTableIter iter;
1641 node_t *node_iter = NULL;
1644 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node_iter)) {
1645 resource_node_score(rsc, node_iter, score, tag);
1649 if (node == NULL && score == -
INFINITY) {
1658 #define sort_return(an_int, why) do { \
1661 crm_trace("%s (%d) %c %s (%d) : %s", \
1662 a_xml_id, a_call_id, an_int>0?'>':an_int<0?'<':'=', \
1663 b_xml_id, b_call_id, why); \
1673 char *a_uuid = NULL;
1674 char *b_uuid = NULL;
1676 const xmlNode *xml_a = a;
1677 const xmlNode *xml_b = b;
1688 pe_err(
"Duplicate lrm_rsc_op entries named %s", a_xml_id);
1695 if (a_call_id == -1 && b_call_id == -1) {
1701 }
else if (a_call_id >= 0 && a_call_id < b_call_id) {
1704 }
else if (b_call_id >= 0 && a_call_id > b_call_id) {
1707 }
else if (b_call_id >= 0 && a_call_id == b_call_id) {
1719 (
long long) last_a, (
long long) last_b);
1720 if (last_a >= 0 && last_a < last_b) {
1723 }
else if (last_b >= 0 && last_a > last_b) {
1764 if (b_call_id == -1) {
1767 }
else if (a_call_id == -1) {
1771 }
else if ((a_id >= 0 && a_id < b_id) || b_id == -1) {
1774 }
else if ((b_id >= 0 && a_id > b_id) || a_id == -1) {
1788 if (data_set->
now == NULL) {
1807 if (value == NULL ||
safe_str_eq(
"started", value)
1825 crm_config_err(
"%s is not part of a promotable clone resource, a %s of '%s' makes no sense",
1846 if (lh_action == NULL || rh_action == NULL) {
1857 for (; gIter != NULL; gIter = gIter->next) {
1860 if (after->
action == rh_action && (after->
type & order)) {
1866 wrapper->
action = rh_action;
1867 wrapper->
type = order;
1870 list = g_list_prepend(list, wrapper);
1879 wrapper->
action = lh_action;
1880 wrapper->
type = order;
1882 list = g_list_prepend(list, wrapper);
1893 op = g_hash_table_lookup(data_set->
singletons, name);
1896 op =
custom_action(NULL, strdup(name), name, NULL, TRUE, TRUE, data_set);
1909 if (ticket->
state) {
1910 g_hash_table_destroy(ticket->
state);
1921 if (ticket_id == NULL || strlen(ticket_id) == 0) {
1925 if (data_set->
tickets == NULL) {
1931 ticket = g_hash_table_lookup(data_set->
tickets, ticket_id);
1932 if (ticket == NULL) {
1934 ticket = calloc(1,
sizeof(
ticket_t));
1935 if (ticket == NULL) {
1936 crm_err(
"Cannot allocate ticket '%s'", ticket_id);
1940 crm_trace(
"Creaing ticket entry for %s", ticket_id);
1942 ticket->
id = strdup(ticket_id);
1946 ticket->
state = crm_str_table_new();
1948 g_hash_table_insert(data_set->
tickets, strdup(ticket->
id), ticket);
1955 filter_parameters(xmlNode * param_set,
const char *param_string,
bool need_present)
1957 if (param_set && param_string) {
1958 xmlAttrPtr xIter = param_set->properties;
1961 const char *prop_name = (
const char *)xIter->name;
1963 char *match = strstr(param_string, name);
1968 xIter = xIter->next;
1970 if (need_present && match == NULL) {
1971 crm_trace(
"%s not found in %s", prop_name, param_string);
1974 }
else if (need_present == FALSE && match) {
1975 crm_trace(
"%s found in %s", prop_name, param_string);
1982 #if ENABLE_VERSIONED_ATTRS
1984 append_versioned_params(xmlNode *versioned_params,
const char *ra_version, xmlNode *params)
1986 GHashTable *hash = pe_unpack_versioned_parameters(versioned_params, ra_version);
1989 GHashTableIter iter;
1991 g_hash_table_iter_init(&iter, hash);
1992 while (g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &value)) {
1995 g_hash_table_destroy(hash);
2014 rsc_action_digest(
pe_resource_t *rsc,
const char *task,
const char *key,
2015 pe_node_t *node, xmlNode *xml_op,
bool calc_secure,
2022 GHashTable *local_rsc_params = crm_str_table_new();
2024 #if ENABLE_VERSIONED_ATTRS
2026 const char *ra_version = NULL;
2029 const char *op_version;
2030 const char *restart_list = NULL;
2031 const char *secure_list =
" passwd password ";
2037 #if ENABLE_VERSIONED_ATTRS
2038 pe_get_versioned_attributes(local_versioned_params, rsc, node, data_set);
2046 crm_trace(
"Set address for bundle connection %s (on %s)",
2050 g_hash_table_foreach(local_rsc_params,
hash2field,
data->params_all);
2060 #if ENABLE_VERSIONED_ATTRS
2068 #if ENABLE_VERSIONED_ATTRS
2069 append_versioned_params(local_versioned_params, ra_version,
data->params_all);
2070 append_versioned_params(rsc->versioned_parameters, ra_version,
data->params_all);
2073 pe_rsc_action_details_t *details = pe_rsc_action_details(action);
2074 append_versioned_params(details->versioned_parameters, ra_version,
data->params_all);
2080 g_hash_table_destroy(local_rsc_params);
2088 filter_parameters(
data->params_secure, secure_list, FALSE);
2096 filter_parameters(
data->params_restart, restart_list, TRUE);
2114 guint interval_ms = 0;
2116 const char *op_version;
2120 const char *digest_all;
2121 const char *digest_restart;
2131 data = rsc_action_digest(rsc, task, key, node, xml_op,
2136 if (digest_restart &&
data->digest_restart_calc && strcmp(
data->digest_restart_calc, digest_restart) != 0) {
2137 pe_rsc_info(rsc,
"Parameters to %s on %s changed: was %s vs. now %s (restart:%s) %s",
2139 crm_str(digest_restart),
data->digest_restart_calc,
2143 }
else if (digest_all == NULL) {
2147 }
else if (strcmp(digest_all,
data->digest_all_calc) != 0) {
2148 pe_rsc_info(rsc,
"Parameters to %s on %s changed: was %s vs. now %s (%s:%s) %s",
2151 (interval_ms > 0)?
"reschedule" :
"reload",
2177 static inline char *
2178 create_unfencing_summary(
const char *rsc_id,
const char *agent_type,
2179 const char *param_digest)
2201 unfencing_digest_matches(
const char *rsc_id,
const char *agent,
2202 const char *digest_calc,
const char *node_summary)
2204 bool matches = FALSE;
2206 if (rsc_id && agent && digest_calc && node_summary) {
2207 char *search_secure = create_unfencing_summary(rsc_id, agent,
2213 matches = (strstr(node_summary, search_secure) != NULL);
2214 crm_trace(
"Calculated unfencing digest '%s' %sfound in '%s'",
2215 search_secure, matches?
"" :
"not ", node_summary);
2216 free(search_secure);
2225 #define STONITH_DIGEST_TASK "stonith-on"
2239 fencing_action_digest_cmp(
pe_resource_t *rsc,
const char *agent,
2242 const char *node_summary = NULL;
2247 node, NULL, TRUE, data_set);
2253 if (node_summary == NULL) {
2259 if (unfencing_digest_matches(rsc->
id, agent,
data->digest_all_calc,
2267 if (unfencing_digest_matches(rsc->
id, agent,
data->digest_secure_calc,
2271 printf(
"Only 'private' parameters to %s for unfencing %s changed\n",
2280 &&
data->digest_secure_calc) {
2281 char *digest = create_unfencing_summary(rsc->
id, agent,
2282 data->digest_secure_calc);
2284 printf(
"Parameters to %s for unfencing %s changed, try '%s'\n",
2294 return ID(rsc->
xml);
2305 for (; gIter != NULL; gIter = gIter->next) {
2318 for (; gIter != NULL; gIter = gIter->next) {
2328 for (
GListPtr gIter = candidates; gIter != NULL; gIter = gIter->next) {
2334 matches = find_unfencing_devices(candidate->
children, matches);
2338 }
else if (
crm_str_eq(provides,
"unfencing", FALSE) ||
crm_str_eq(requires,
"unfencing", FALSE)) {
2339 matches = g_list_prepend(matches, candidate);
2349 char *op_key = NULL;
2359 stonith_op = g_hash_table_lookup(data_set->
singletons, op_key);
2362 if(stonith_op == NULL) {
2377 long digests_all_offset = 0;
2378 long digests_secure_offset = 0;
2380 char *digests_all = calloc(max,
sizeof(
char));
2381 char *digests_secure = calloc(max,
sizeof(
char));
2384 for (
GListPtr gIter = matches; gIter != NULL; gIter = gIter->next) {
2386 const char *agent = g_hash_table_lookup(match->
meta,
2390 data = fencing_action_digest_cmp(match, agent, node, data_set);
2395 fprintf(stdout,
" notice: Unfencing %s (remote): because the definition of %s changed\n", node->
details->
uname, match->
id);
2399 digests_all_offset += snprintf(
2400 digests_all+digests_all_offset, max-digests_all_offset,
2401 "%s:%s:%s,", match->
id, agent,
data->digest_all_calc);
2403 digests_secure_offset += snprintf(
2404 digests_secure+digests_secure_offset, max-digests_secure_offset,
2405 "%s:%s:%s,", match->
id, agent,
data->digest_secure_calc);
2407 g_hash_table_insert(stonith_op->
meta,
2410 g_hash_table_insert(stonith_op->
meta,
2419 if(optional == FALSE &&
pe_can_fence(data_set, node)) {
2421 }
else if(reason && stonith_op->
reason == NULL) {
2422 stonith_op->
reason = strdup(reason);
2451 GHashTableIter iter;
2454 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
2455 if(node->details->online && node->details->unclean == FALSE && node->details->shutdown == FALSE) {
2463 add_tag_ref(GHashTable * tags,
const char * tag_name,
const char * obj_ref)
2467 gboolean is_existing = FALSE;
2469 CRM_CHECK(tags && tag_name && obj_ref,
return FALSE);
2471 tag = g_hash_table_lookup(tags, tag_name);
2473 tag = calloc(1,
sizeof(
tag_t));
2477 tag->
id = strdup(tag_name);
2479 g_hash_table_insert(tags, strdup(tag_name), tag);
2482 for (gIter = tag->
refs; gIter != NULL; gIter = gIter->next) {
2483 const char *existing_ref = (
const char *) gIter->data;
2485 if (
crm_str_eq(existing_ref, obj_ref, TRUE)){
2491 if (is_existing == FALSE) {
2492 tag->
refs = g_list_append(tag->
refs, strdup(obj_ref));
2493 crm_trace(
"Added: tag=%s ref=%s", tag->
id, obj_ref);
2504 bool update = FALSE;
2505 const char *change = NULL;
2509 change =
"unrunnable";
2512 change =
"required";
2516 change =
"unrunnable";
2518 change =
"dangling";
2520 change =
"required";
2522 crm_err(
"Unknown flag change to %x by %s: 0x%s",
2539 if((change && update) || text) {
2540 char *reason_text = NULL;
2541 if(reason == NULL) {
2544 }
else if(reason->
rsc == NULL) {
2550 if(reason_text && action->
rsc != reason->
rsc) {
2559 if(action->
reason && overwrite) {
2564 if(action->
reason == NULL) {
2567 action->
reason = strdup(reason);
2591 return shutdown && strcmp(shutdown,
"0");
2617 GHashTable *node_hash, GHashTable *hash,
2618 const char *always_first, gboolean overwrite,
2624 always_first, overwrite, data_set->
now, next_change);
2636 const char *target_role = NULL;