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 }
else if (merge_scores) {
128 for (; gIter != NULL; gIter = gIter->next) {
133 if (other_node == NULL) {
137 g_hash_table_insert(
result, (gpointer) new_node->
details->
id, new_node);
153 GHashTable *
result = NULL;
156 for (GList *gIter = list; gIter != NULL; gIter = gIter->next) {
159 g_hash_table_insert(
result, (gpointer) new_node->
details->
id, new_node);
210 pe__output_node_weights(
pe_resource_t *rsc,
const char *comment,
216 GList *list = g_list_sort(g_hash_table_get_values(nodes),
219 for (GList *gIter = list; gIter != NULL; gIter = gIter->next) {
240 pe__log_node_weights(
const char *file,
const char *
function,
int line,
249 g_hash_table_iter_init(&iter, nodes);
250 while (g_hash_table_iter_next(&iter, NULL, (
void **) &node)) {
252 qb_log_from_external_source(
function, file,
253 "%s: %s allocation score on %s: %s",
259 qb_log_from_external_source(
function, file,
"%s: %s = %s",
261 comment, pe__node_name(node),
294 pe__log_node_weights(file,
function, line, rsc, comment, nodes);
296 pe__output_node_weights(rsc, comment, nodes,
data_set);
301 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
330 if (a == NULL && b == NULL) {
367 for (; gIter != NULL; gIter = gIter->next) {
370 resource_node_score(child_rsc, node, score, tag);
375 tag, rsc->
id, pe__node_name(node), score);
389 resource_node_score(rsc, node, score, tag);
394 for (; gIter != NULL; gIter = gIter->next) {
397 resource_node_score(rsc, node_iter, score, tag);
405 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node_iter)) {
406 resource_node_score(rsc, node_iter, score, tag);
410 if (node == NULL && score == -
INFINITY) {
451 "because '%s' is not valid", rsc->
id, value);
463 "because '%s' only makes sense for promotable " 464 "clones", rsc->
id, value);
484 if (lh_action == NULL || rh_action == NULL) {
488 crm_trace(
"Creating action wrappers for ordering: %s then %s",
496 for (; gIter != NULL; gIter = gIter->next) {
499 if (after->
action == rh_action && (after->
type & order)) {
505 wrapper->
action = rh_action;
506 wrapper->
type = order;
508 list = g_list_prepend(list, wrapper);
512 wrapper->
action = lh_action;
513 wrapper->
type = order;
515 list = g_list_prepend(list, wrapper);
526 g_hash_table_destroy(ticket->
state);
537 if (pcmk__str_empty(ticket_id)) {
546 if (ticket == NULL) {
549 if (ticket == NULL) {
550 crm_err(
"Cannot allocate ticket '%s'", ticket_id);
554 crm_trace(
"Creaing ticket entry for %s", ticket_id);
556 ticket->
id = strdup(ticket_id);
580 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
598 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
611 }
else if ((rsc != NULL)
630 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
631 if(node->details->online && node->details->unclean == FALSE && node->details->shutdown == FALSE) {
639 add_tag_ref(GHashTable * tags,
const char * tag_name,
const char * obj_ref)
643 gboolean is_existing = FALSE;
645 CRM_CHECK(tags && tag_name && obj_ref,
return FALSE);
647 tag = g_hash_table_lookup(tags, tag_name);
653 tag->
id = strdup(tag_name);
655 g_hash_table_insert(tags, strdup(tag_name), tag);
658 for (gIter = tag->
refs; gIter != NULL; gIter = gIter->next) {
659 const char *existing_ref = (
const char *) gIter->data;
667 if (is_existing == FALSE) {
668 tag->
refs = g_list_append(tag->
refs, strdup(obj_ref));
669 crm_trace(
"Added: tag=%s ref=%s", tag->
id, obj_ref);
719 const char *always_first, gboolean overwrite,
725 always_first, overwrite, next_change);
737 const char *target_role = NULL;
756 for (GList *ele = rsc->
running_on; ele; ele = ele->next) {
776 GList *retval = NULL;
778 for (GList *gIter = rscs; gIter; gIter = gIter->next) {
786 retval = g_list_prepend(retval, rsc);
802 nodes = g_list_prepend(nodes, strdup(
"*"));
810 nodes = g_list_prepend(nodes, strdup(s));
827 GList *resources = NULL;
830 resources = g_list_prepend(resources, strdup(
"*"));
841 if (strstr(s,
":") != NULL) {
842 resources = g_list_prepend(resources, strdup(rsc->
id));
862 const char *rsc_id = rsc->
id;
870 for (xmlNode *xml_op = pcmk__xml_first_child(rsc->
cluster->
failed); xml_op != NULL;
871 xml_op = pcmk__xml_next(xml_op)) {
872 const char *value = NULL;
890 if (!
parse_op_key(value ? value :
ID(xml_op), &op_id, NULL, NULL)) {
crm_time_t * crm_time_new_undefined(void)
Allocate memory for an uninitialized time object.
bool pe__shutdown_requested(pe_node_t *node)
#define CRM_CHECK(expr, failure_action)
pe_node_t * pe_find_node(GList *node_list, const char *uname)
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)
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)
void pe__unpack_dataset_nvpairs(const xmlNode *xml_obj, const char *set_name, pe_rule_eval_data_t *rule_data, GHashTable *hash, const char *always_first, gboolean overwrite, pe_working_set_t *data_set)
pe_resource_t * container
void pe_eval_nvpairs(xmlNode *top, const xmlNode *xml_obj, const char *set_name, pe_rule_eval_data_t *rule_data, GHashTable *hash, const char *always_first, gboolean overwrite, crm_time_t *next_change)
int(* message)(pcmk__output_t *out, const char *message_id,...)
struct crm_time_s crm_time_t
void resource_location(pe_resource_t *rsc, pe_node_t *node, int score, const char *tag, pe_working_set_t *data_set)
gboolean exclusive_discover
#define pcmk__config_err(fmt...)
pe_resource_t * remote_rsc
resource_object_functions_t * fns
#define pcmk__log_else(level, else_action)
void pe__show_node_weights_as(const char *file, const char *function, int line, bool to_log, pe_resource_t *rsc, const char *comment, GHashTable *nodes, pe_working_set_t *data_set)
bool pcmk__rsc_filtered_by_node(pe_resource_t *rsc, GList *only_node)
bool pe_can_fence(pe_working_set_t *data_set, pe_node_t *node)
#define pe_flag_have_quorum
pe_ticket_t * ticket_new(const char *ticket_id, 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)
bool pe__resource_is_disabled(pe_resource_t *rsc)
#define XML_LRM_ATTR_TASK_KEY
gboolean ghash_free_str_str(gpointer key, gpointer value, gpointer user_data)
const char * pe__clone_child_id(pe_resource_t *rsc)
gboolean add_tag_ref(GHashTable *tags, const char *tag_name, const char *obj_ref)
gint pe__cmp_node_name(gconstpointer a, gconstpointer b)
pe_resource_t * uber_parent(pe_resource_t *rsc)
#define XML_CIB_ATTR_SHUTDOWN
bool pe__rsc_running_on_any(pe_resource_t *rsc, GList *node_list)
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)
GHashTable * pe__node_list2table(GList *list)
gboolean get_target_role(pe_resource_t *rsc, enum rsc_role_e *role)
#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
#define pe_rsc_promotable
pe_working_set_t * data_set
bool pcmk_xe_mask_probe_failure(xmlNode *xml_op)
#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)
enum pe_obj_types variant
long long crm_time_get_seconds_since_epoch(const crm_time_t *dt)
#define pe_rsc_fence_device
pe_node_t * pe_find_node_id(GList *node_list, const char *id)
match resource ID or LRM history ID
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
#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)
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
const char * rsc_printable_id(pe_resource_t *rsc)
#define XML_LRM_ATTR_TARGET
#define pe_rsc_trace(rsc, fmt, args...)
GList * pe__unames_with_tag(pe_working_set_t *data_set, const char *tag_name)
#define crm_info(fmt, args...)
gint pe__cmp_rsc_priority(gconstpointer a, gconstpointer b)
xmlNode * pe__failed_probe_for_rsc(pe_resource_t *rsc, const char *name)
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)