44 for (GList *n = rsc->
running_on; n != NULL; n = n->next) {
66 }
else if(node == NULL) {
70 crm_notice(
"We can fence %s without quorum because they're in our membership",
75 crm_trace(
"Cannot fence %s", pe__node_name(node));
110 GHashTable *
result = hash;
117 g_hash_table_iter_init(&iter, hash);
118 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
121 if (other_node == NULL) {
123 crm_trace(
"Banning dependent from %s (no primary instance)",
124 pe__node_name(node));
125 }
else if (merge_scores) {
127 crm_trace(
"Added primary's score %s to dependent's score for %s " 133 for (; gIter != NULL; gIter = gIter->next) {
138 if (other_node == NULL) {
142 g_hash_table_insert(
result, (gpointer) new_node->
details->
id, new_node);
158 GHashTable *
result = NULL;
161 for (
const GList *gIter = list; gIter != NULL; gIter = gIter->next) {
164 g_hash_table_insert(
result, (gpointer) new_node->
details->
id, new_node);
216 pe__output_node_weights(
const pe_resource_t *rsc,
const char *comment,
222 GList *list = g_list_sort(g_hash_table_get_values(nodes),
225 for (
const GList *gIter = list; gIter != NULL; gIter = gIter->next) {
246 pe__log_node_weights(
const char *file,
const char *
function,
int line,
256 g_hash_table_iter_init(&iter, nodes);
257 while (g_hash_table_iter_next(&iter, NULL, (
void **) &node)) {
259 qb_log_from_external_source(
function, file,
260 "%s: %s allocation score on %s: %s",
266 qb_log_from_external_source(
function, file,
"%s: %s = %s",
268 comment, pe__node_name(node),
291 const char *comment, GHashTable *nodes,
304 pe__log_node_weights(file,
function, line, rsc, comment, nodes);
306 pe__output_node_weights(rsc, comment, nodes,
data_set);
311 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
340 if (a == NULL && b == NULL) {
378 for (; gIter != NULL; gIter = gIter->next) {
381 resource_node_score(child_rsc, node, score, tag);
392 "Enabling %s preference (%s) for %s on %s (now %s)",
402 resource_node_score(rsc, node, score, tag);
407 for (; gIter != NULL; gIter = gIter->next) {
410 resource_node_score(rsc, node_iter, score, tag);
418 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node_iter)) {
419 resource_node_score(rsc, node_iter, score, tag);
423 if (node == NULL && score == -
INFINITY) {
464 "because '%s' is not valid", rsc->
id, value);
477 "because '%s' only makes sense for promotable " 478 "clones", rsc->
id, value);
498 if (lh_action == NULL || rh_action == NULL) {
502 crm_trace(
"Creating action wrappers for ordering: %s then %s",
510 for (; gIter != NULL; gIter = gIter->next) {
513 if (after->
action == rh_action && (after->
type & order)) {
519 wrapper->
action = rh_action;
520 wrapper->
type = order;
522 list = g_list_prepend(list, wrapper);
526 wrapper->
action = lh_action;
527 wrapper->
type = order;
529 list = g_list_prepend(list, wrapper);
540 g_hash_table_destroy(ticket->
state);
551 if (pcmk__str_empty(ticket_id)) {
560 if (ticket == NULL) {
563 if (ticket == NULL) {
564 crm_err(
"Cannot allocate ticket '%s'", ticket_id);
568 crm_trace(
"Creaing ticket entry for %s", ticket_id);
570 ticket->
id = strdup(ticket_id);
592 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
610 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
623 }
else if ((rsc != NULL)
642 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
643 if(node->details->online && node->details->unclean == FALSE && node->details->shutdown == FALSE) {
651 add_tag_ref(GHashTable * tags,
const char * tag_name,
const char * obj_ref)
655 gboolean is_existing = FALSE;
657 CRM_CHECK(tags && tag_name && obj_ref,
return FALSE);
659 tag = g_hash_table_lookup(tags, tag_name);
665 tag->
id = strdup(tag_name);
667 g_hash_table_insert(tags, strdup(tag_name), tag);
670 for (gIter = tag->
refs; gIter != NULL; gIter = gIter->next) {
671 const char *existing_ref = (
const char *) gIter->data;
679 if (is_existing == FALSE) {
680 tag->
refs = g_list_append(tag->
refs, strdup(obj_ref));
681 crm_trace(
"Added: tag=%s ref=%s", tag->
id, obj_ref);
739 GHashTable *hash,
const char *always_first,
745 always_first, overwrite, next_change);
757 const char *target_role = NULL;
786 return (rsc != NULL) && pcmk__list_of_1(rsc->
running_on)
793 for (GList *ele = rsc->
running_on; ele; ele = ele->next) {
813 GList *retval = NULL;
815 for (GList *gIter = rscs; gIter; gIter = gIter->next) {
823 retval = g_list_prepend(retval, rsc);
839 nodes = g_list_prepend(nodes, strdup(
"*"));
847 nodes = g_list_prepend(nodes, strdup(s));
864 GList *resources = NULL;
867 resources = g_list_prepend(resources, strdup(
"*"));
878 if (strstr(s,
":") != NULL) {
879 resources = g_list_prepend(resources, strdup(rsc->
id));
899 const char *rsc_id = rsc->
id;
905 for (xmlNode *xml_op = pcmk__xml_first_child(rsc->
cluster->
failed); xml_op != NULL;
906 xml_op = pcmk__xml_next(xml_op)) {
907 const char *value = NULL;
923 if (!
parse_op_key(pe__xe_history_key(xml_op), &op_id, NULL, NULL)) {
crm_time_t * crm_time_new_undefined(void)
Allocate memory for an uninitialized time object.
#define CRM_CHECK(expr, failure_action)
enum pe_quorum_policy no_quorum_policy
gboolean parse_op_key(const char *key, char **rsc_id, char **op_type, guint *interval_ms)
void destroy_ticket(gpointer data)
#define crm_notice(fmt, args...)
pe_resource_t * pe_find_resource_with_flags(GList *rsc_list, const char *id, enum pe_find flags)
pe_node_t * pe__copy_node(const pe_node_t *this_node)
#define pcmk__if_tracing(if_action, else_action)
GHashTable * pe__node_list2table(const GList *list)
void trigger_unfencing(pe_resource_t *rsc, pe_node_t *node, const char *reason, pe_action_t *dependency, pe_working_set_t *data_set)
time_t get_effective_time(pe_working_set_t *data_set)
gboolean order_actions(pe_action_t *lh_action, pe_action_t *rh_action, enum pe_ordering order)
bool crm_time_is_defined(const crm_time_t *t)
Check whether a time object has been initialized yet.
const char * pcmk_readable_score(int score)
Return a displayable static string for a score value.
GList * pe__build_rsc_list(pe_working_set_t *data_set, const char *s)
pe_resource_t * container
int(* message)(pcmk__output_t *out, const char *message_id,...)
struct crm_time_s crm_time_t
gboolean exclusive_discover
#define pcmk__config_err(fmt...)
pe_resource_t * remote_rsc
resource_object_functions_t * fns
const pe_resource_t * pe__const_top_resource(const pe_resource_t *rsc, bool include_bundle)
bool pcmk__rsc_filtered_by_node(pe_resource_t *rsc, GList *only_node)
#define pe_flag_have_quorum
pe_ticket_t * ticket_new(const char *ticket_id, pe_working_set_t *data_set)
void pe__unpack_dataset_nvpairs(const xmlNode *xml_obj, const char *set_name, const pe_rule_eval_data_t *rule_data, GHashTable *hash, const char *always_first, gboolean overwrite, pe_working_set_t *data_set)
void pe__update_recheck_time(time_t recheck, pe_working_set_t *data_set)
GList * pe__rscs_with_tag(pe_working_set_t *data_set, const char *tag_name)
#define pe__set_resource_flags(resource, flags_to_set)
gboolean ghash_free_str_str(gpointer key, gpointer value, gpointer user_data)
gboolean add_tag_ref(GHashTable *tags, const char *tag_name, const char *obj_ref)
gint pe__cmp_node_name(gconstpointer a, gconstpointer b)
bool pcmk_xe_mask_probe_failure(const xmlNode *xml_op)
void resource_location(pe_resource_t *rsc, const pe_node_t *node, int score, const char *tag, pe_working_set_t *data_set)
bool pe__rsc_running_on_only(const pe_resource_t *rsc, const pe_node_t *node)
#define XML_CIB_ATTR_SHUTDOWN
bool pe__rsc_running_on_any(pe_resource_t *rsc, GList *node_list)
void pe_eval_nvpairs(xmlNode *top, const xmlNode *xml_obj, const char *set_name, const pe_rule_eval_data_t *rule_data, GHashTable *hash, const char *always_first, gboolean overwrite, crm_time_t *next_change)
Extract nvpair blocks contained by an XML element into a hash table.
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
void node_list_exclude(GHashTable *hash, GList *list, gboolean merge_scores)
const char * pe_node_attribute_raw(const pe_node_t *node, const char *name)
bool pe__is_guest_node(const pe_node_t *node)
bool pe__shutdown_requested(const pe_node_t *node)
#define crm_trace(fmt, args...)
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
struct pe_node_shared_s * details
bool pe_can_fence(const pe_working_set_t *data_set, const pe_node_t *node)
#define pe_rsc_promotable
pe_working_set_t * data_set
const char * pe__clone_child_id(const pe_resource_t *rsc)
#define pe_flag_stonith_enabled
#define XML_RSC_ATTR_TARGET_ROLE
void pe__clear_resource_flags_recursive(pe_resource_t *rsc, uint64_t flags)
match base name of any clone instance
enum rsc_role_e text2role(const char *role)
long long crm_time_get_seconds_since_epoch(const crm_time_t *dt)
xmlNode * pe__failed_probe_for_rsc(const pe_resource_t *rsc, const char *name)
#define pe_rsc_fence_device
match resource ID or LRM history ID
pe_node_t * pe_find_node_id(const GList *node_list, const char *id)
Find a node by ID in a list of nodes.
GList * pe__build_node_name_list(pe_working_set_t *data_set, const char *s)
GHashTable * pcmk__strkey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
pcmk__action_result_t result
bool pe__resource_is_disabled(const pe_resource_t *rsc)
#define crm_err(fmt, args...)
crm_time_t * crm_time_new(const char *string)
This structure contains everything that makes up a single output formatter.
#define pe__clear_resource_flags(resource, flags_to_clear)
pe_node_t * pe_find_node(const GList *node_list, const char *node_name)
Find a node by name in a list of nodes.
const char * rsc_printable_id(const pe_resource_t *rsc)
int pcmk__numeric_strcasecmp(const char *s1, const char *s2)
rsc_role_e
Possible roles that a resource can be in.
void pe__set_resource_flags_recursive(pe_resource_t *rsc, uint64_t flags)
pe_working_set_t * cluster
int pcmk__add_scores(int score1, int score2)
void pe__clear_resource_flags_on_all(pe_working_set_t *data_set, uint64_t flag)
GList * pe__filter_rsc_list(GList *rscs, GList *filter)
#define pe_flag_have_stonith_resource
#define pe_flag_enable_unfencing
#define XML_LRM_ATTR_TARGET
#define pe_rsc_trace(rsc, fmt, args...)
void pe__show_node_weights_as(const char *file, const char *function, int line, bool to_log, const pe_resource_t *rsc, const char *comment, GHashTable *nodes, pe_working_set_t *data_set)
GList * pe__unames_with_tag(pe_working_set_t *data_set, const char *tag_name)
gboolean get_target_role(const pe_resource_t *rsc, enum rsc_role_e *role)
#define crm_info(fmt, args...)
gint pe__cmp_rsc_priority(gconstpointer a, gconstpointer b)
pe_action_t * pe_fence_op(pe_node_t *node, const char *op, bool optional, const char *reason, bool priority_delay, pe_working_set_t *data_set)
gboolean(* active)(pe_resource_t *, gboolean)
GHashTable * allowed_nodes
gboolean pcmk__str_in_list(const gchar *s, const GList *lst, uint32_t flags)
void crm_time_free(crm_time_t *dt)