38 if (pcmk__is_guest_or_bundle_node(node)) {
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",
71 pcmk__node_name(node));
75 crm_trace(
"Cannot fence %s", pcmk__node_name(node));
117 GHashTable *
result = NULL;
120 for (
const GList *gIter = list; gIter != NULL; gIter = gIter->next) {
124 g_hash_table_insert(
result, (gpointer) new_node->
details->
id, new_node);
176 pe__output_node_weights(
const pcmk_resource_t *rsc,
const char *comment,
182 GList *list = g_list_sort(g_hash_table_get_values(nodes),
185 for (
const GList *gIter = list; gIter != NULL; gIter = gIter->next) {
206 pe__log_node_weights(
const char *file,
const char *
function,
int line,
216 g_hash_table_iter_init(&iter, nodes);
217 while (g_hash_table_iter_next(&iter, NULL, (
void **) &node)) {
219 qb_log_from_external_source(
function, file,
220 "%s: %s allocation score on %s: %s",
223 pcmk__node_name(node),
226 qb_log_from_external_source(
function, file,
"%s: %s = %s",
228 comment, pcmk__node_name(node),
251 const char *comment, GHashTable *nodes,
264 pe__log_node_weights(file,
function, line, rsc, comment, nodes);
266 pe__output_node_weights(rsc, comment, nodes,
scheduler);
271 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
300 if (a == NULL && b == NULL) {
339 for (; gIter != NULL; gIter = gIter->next) {
342 resource_node_score(child_rsc, node, score, tag);
353 "Enabling %s preference (%s) for %s on %s (now %s)",
363 resource_node_score(rsc, node, score, tag);
368 for (; gIter != NULL; gIter = gIter->next) {
371 resource_node_score(rsc, node_iter, score, tag);
379 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node_iter)) {
380 resource_node_score(rsc, node_iter, score, tag);
425 "' is deprecated and will be removed in a " 426 "future release (just leave it unset)");
433 "because '%s' is not valid", rsc->
id, value);
446 "because '%s' only makes sense for promotable " 447 "clones", rsc->
id, value);
467 if ((first == NULL) || (then == NULL)) {
471 crm_trace(
"Creating action wrappers for ordering: %s then %s",
479 for (; gIter != NULL; gIter = gIter->next) {
482 if ((after->
action == then)
483 && pcmk_any_flags_set(after->
type,
flags)) {
492 list = g_list_prepend(list, wrapper);
499 list = g_list_prepend(list, wrapper);
510 g_hash_table_destroy(ticket->
state);
521 if (pcmk__str_empty(ticket_id)) {
530 if (ticket == NULL) {
533 if (ticket == NULL) {
538 crm_trace(
"Creating ticket entry for %s", ticket_id);
540 ticket->
id = strdup(ticket_id);
558 return pcmk__xe_id(rsc->
xml);
565 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
584 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
598 }
else if ((rsc != NULL)
618 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
619 if(node->details->online && node->details->unclean == FALSE && node->details->shutdown == FALSE) {
627 add_tag_ref(GHashTable * tags,
const char * tag_name,
const char * obj_ref)
631 gboolean is_existing = FALSE;
633 CRM_CHECK(tags && tag_name && obj_ref,
return FALSE);
635 tag = g_hash_table_lookup(tags, tag_name);
642 tag->
id = strdup(tag_name);
644 g_hash_table_insert(tags, strdup(tag_name), tag);
647 for (gIter = tag->
refs; gIter != NULL; gIter = gIter->next) {
648 const char *existing_ref = (
const char *) gIter->data;
656 if (is_existing == FALSE) {
657 tag->
refs = g_list_append(tag->
refs, strdup(obj_ref));
658 crm_trace(
"Added: tag=%s ref=%s", tag->
id, obj_ref);
701 crm_debug(
"Updated next scheduler recheck to %s for %s",
721 GHashTable *hash,
const char *always_first,
727 always_first, overwrite, next_change);
739 const char *target_role = NULL;
769 return (rsc != NULL) && pcmk__list_of_1(rsc->
running_on)
777 for (GList *ele = rsc->
running_on; ele; ele = ele->next) {
797 GList *retval = NULL;
799 for (GList *gIter = rscs; gIter; gIter = gIter->next) {
807 retval = g_list_prepend(retval, rsc);
824 nodes = g_list_prepend(nodes, strdup(
"*"));
832 nodes = g_list_prepend(nodes, strdup(s));
850 GList *resources = NULL;
853 resources = g_list_prepend(resources, strdup(
"*"));
865 if (strstr(s,
":") != NULL) {
866 resources = g_list_prepend(resources, strdup(rsc->
id));
886 const char *rsc_id = rsc->
id;
888 if (pcmk__is_clone(
parent)) {
894 xml_op != NULL; xml_op = pcmk__xe_next(xml_op)) {
896 const char *value = NULL;
912 if (!
parse_op_key(pcmk__xe_history_key(xml_op), &op_id, NULL, NULL)) {
crm_time_t * crm_time_new_undefined(void)
Allocate memory for an uninitialized time object.
const pcmk_resource_t * pe__const_top_resource(const pcmk_resource_t *rsc, bool include_bundle)
#define CRM_CHECK(expr, failure_action)
pcmk_node_t * pcmk_find_node(const pcmk_scheduler_t *scheduler, const char *node_name)
Find a node by name in scheduler data.
enum pe_quorum_policy no_quorum_policy
void destroy_ticket(gpointer data)
#define crm_notice(fmt, args...)
pcmk_scheduler_t * cluster
#define PCMK__NODE_ATTR_SHUTDOWN
#define pcmk__if_tracing(if_action, else_action)
void pe__clear_resource_flags_on_all(pcmk_scheduler_t *scheduler, uint64_t flag)
GHashTable * pe__node_list2table(const GList *list)
bool crm_time_is_defined(const crm_time_t *t)
Check whether a time object has been initialized yet.
void pe__update_recheck_time(time_t recheck, pcmk_scheduler_t *scheduler, const char *reason)
int(* message)(pcmk__output_t *out, const char *message_id,...)
const char * pcmk_readable_score(int score)
Return a displayable static string for a score value.
pcmk_resource_t * pe_find_resource_with_flags(GList *rsc_list, const char *id, enum pe_find flags)
struct crm_time_s crm_time_t
#define pcmk__config_warn(fmt...)
#define pcmk__rsc_trace(rsc, fmt, args...)
gboolean exclusive_discover
gboolean get_target_role(const pcmk_resource_t *rsc, enum rsc_role_e *role)
#define pcmk__config_err(fmt...)
void pe__clear_resource_flags_recursive(pcmk_resource_t *rsc, uint64_t flags)
pcmk_action_t * pe_fence_op(pcmk_node_t *node, const char *op, bool optional, const char *reason, bool priority_delay, pcmk_scheduler_t *scheduler)
#define PCMK_VALUE_DEFAULT
GList * pe__rscs_with_tag(pcmk_scheduler_t *scheduler, const char *tag_name)
bool pe_can_fence(const pcmk_scheduler_t *scheduler, const pcmk_node_t *node)
#define PCMK__META_ON_NODE
pcmk_resource_t * container
void pe__show_node_scores_as(const char *file, const char *function, int line, bool to_log, const pcmk_resource_t *rsc, const char *comment, GHashTable *nodes, pcmk_scheduler_t *scheduler)
enum rsc_role_e pcmk_parse_role(const char *role)
Parse a resource role from a string role specification.
Also match clone instance ID from resource history.
gboolean ghash_free_str_str(gpointer key, gpointer value, gpointer user_data)
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.
gboolean add_tag_ref(GHashTable *tags, const char *tag_name, const char *obj_ref)
gint pe__cmp_node_name(gconstpointer a, gconstpointer b)
time_t get_effective_time(pcmk_scheduler_t *scheduler)
#define crm_debug(fmt, args...)
Actions are ordered (optionally, if no other flags are set)
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
xmlNode * pcmk__xe_first_child(const xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
#define pcmk__sched_err(fmt...)
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, pcmk_scheduler_t *scheduler)
void resource_location(pcmk_resource_t *rsc, const pcmk_node_t *node, int score, const char *tag, pcmk_scheduler_t *scheduler)
bool pcmk_xe_mask_probe_failure(const xmlNode *xml_op)
Check whether an action history entry represents a maskable probe.
#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
GList * pe__unames_with_tag(pcmk_scheduler_t *scheduler, const char *tag_name)
Wrappers for and extensions to libxml2.
#define PCMK_META_TARGET_ROLE
bool pe__resource_is_disabled(const pcmk_resource_t *rsc)
Match clone instances (even unique) by base name as well as exact ID.
pcmk_node_t * pe__copy_node(const pcmk_node_t *this_node)
#define pcmk__set_rsc_flags(resource, flags_to_set)
int pcmk__add_scores(int score1, int score2)
long long crm_time_get_seconds_since_epoch(const crm_time_t *dt)
#define pcmk__assert(expr)
bool pe__rsc_running_on_only(const pcmk_resource_t *rsc, const pcmk_node_t *node)
gboolean(* active)(pcmk_resource_t *rsc, gboolean all)
GList * pe__build_node_name_list(pcmk_scheduler_t *scheduler, const char *s)
GHashTable * pcmk__strkey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
pcmk__action_result_t result
#define PCMK_ROLE_STARTED
pcmk_scheduler_t * scheduler
crm_time_t * crm_time_new(const char *string)
const char * pcmk__node_attr(const pcmk_node_t *node, const char *name, const char *target, enum pcmk__rsc_node node_type)
gboolean order_actions(pcmk_action_t *first, pcmk_action_t *then, uint32_t flags)
This structure contains everything that makes up a single output formatter.
gboolean parse_op_key(const char *key, char **rsc_id, char **op_type, guint *interval_ms)
pcmk_node_t * allocated_to
bool pe__rsc_running_on_any(pcmk_resource_t *rsc, GList *node_list)
bool pe__shutdown_requested(const pcmk_node_t *node)
xmlNode * pe__failed_probe_for_rsc(const pcmk_resource_t *rsc, const char *name)
void pe__set_resource_flags_recursive(pcmk_resource_t *rsc, uint64_t flags)
int pcmk__numeric_strcasecmp(const char *s1, const char *s2)
const char * rsc_printable_id(const pcmk_resource_t *rsc)
GList * pe__filter_rsc_list(GList *rscs, GList *filter)
void trigger_unfencing(pcmk_resource_t *rsc, pcmk_node_t *node, const char *reason, pcmk_action_t *dependency, pcmk_scheduler_t *scheduler)
GList * pe__build_rsc_list(pcmk_scheduler_t *scheduler, const char *s)
Resource role is unknown.
char * pcmk__trim(char *str)
#define pcmk__assert_alloc(nmemb, size)
bool pcmk__rsc_filtered_by_node(pcmk_resource_t *rsc, GList *only_node)
const char * pe__clone_child_id(const pcmk_resource_t *rsc)
#define crm_info(fmt, args...)
#define pcmk__clear_rsc_flags(resource, flags_to_clear)
pcmk_ticket_t * ticket_new(const char *ticket_id, pcmk_scheduler_t *scheduler)
gint pe__cmp_rsc_priority(gconstpointer a, gconstpointer b)
pcmk_resource_t * remote_rsc
No relation (compare with equality rather than bit set)
#define PCMK_SCORE_INFINITY
Integer score to use to represent "infinity".
GHashTable * allowed_nodes
gboolean pcmk__str_in_list(const gchar *s, const GList *lst, uint32_t flags)
Where resource is running.
void crm_time_free(crm_time_t *dt)