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));
118 GHashTable *
result = NULL;
121 for (
const GList *gIter = list; gIter != NULL; gIter = gIter->next) {
125 g_hash_table_insert(
result, (gpointer) new_node->
details->
id, new_node);
177 pe__output_node_weights(
const pcmk_resource_t *rsc,
const char *comment,
183 GList *list = g_list_sort(g_hash_table_get_values(nodes),
186 for (
const GList *gIter = list; gIter != NULL; gIter = gIter->next) {
207 pe__log_node_weights(
const char *file,
const char *
function,
int line,
217 g_hash_table_iter_init(&iter, nodes);
218 while (g_hash_table_iter_next(&iter, NULL, (
void **) &node)) {
220 qb_log_from_external_source(
function, file,
221 "%s: %s allocation score on %s: %s",
227 qb_log_from_external_source(
function, file,
"%s: %s = %s",
229 comment, pe__node_name(node),
252 const char *comment, GHashTable *nodes,
265 pe__log_node_weights(file,
function, line, rsc, comment, nodes);
267 pe__output_node_weights(rsc, comment, nodes,
scheduler);
272 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
301 if (a == NULL && b == NULL) {
340 for (; gIter != NULL; gIter = gIter->next) {
343 resource_node_score(child_rsc, node, score, tag);
354 "Enabling %s preference (%s) for %s on %s (now %s)",
364 resource_node_score(rsc, node, score, tag);
369 for (; gIter != NULL; gIter = gIter->next) {
372 resource_node_score(rsc, node_iter, score, tag);
380 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node_iter)) {
381 resource_node_score(rsc, node_iter, score, tag);
385 if (node == NULL && score == -
INFINITY) {
426 "because '%s' is not valid", rsc->
id, value);
439 "because '%s' only makes sense for promotable " 440 "clones", rsc->
id, value);
461 if (lh_action == NULL || rh_action == NULL) {
465 crm_trace(
"Creating action wrappers for ordering: %s then %s",
473 for (; gIter != NULL; gIter = gIter->next) {
482 wrapper->
action = rh_action;
485 list = g_list_prepend(list, wrapper);
489 wrapper->
action = lh_action;
492 list = g_list_prepend(list, wrapper);
503 g_hash_table_destroy(ticket->
state);
514 if (pcmk__str_empty(ticket_id)) {
523 if (ticket == NULL) {
526 if (ticket == NULL) {
527 crm_err(
"Cannot allocate ticket '%s'", ticket_id);
531 crm_trace(
"Creaing ticket entry for %s", ticket_id);
533 ticket->
id = strdup(ticket_id);
555 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
574 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
588 }
else if ((rsc != NULL)
608 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
609 if(node->details->online && node->details->unclean == FALSE && node->details->shutdown == FALSE) {
617 add_tag_ref(GHashTable * tags,
const char * tag_name,
const char * obj_ref)
621 gboolean is_existing = FALSE;
623 CRM_CHECK(tags && tag_name && obj_ref,
return FALSE);
625 tag = g_hash_table_lookup(tags, tag_name);
631 tag->
id = strdup(tag_name);
633 g_hash_table_insert(tags, strdup(tag_name), tag);
636 for (gIter = tag->
refs; gIter != NULL; gIter = gIter->next) {
637 const char *existing_ref = (
const char *) gIter->data;
645 if (is_existing == FALSE) {
646 tag->
refs = g_list_append(tag->
refs, strdup(obj_ref));
647 crm_trace(
"Added: tag=%s ref=%s", tag->
id, obj_ref);
689 crm_debug(
"Updated next scheduler recheck to %s for %s",
709 GHashTable *hash,
const char *always_first,
715 always_first, overwrite, next_change);
727 const char *target_role = NULL;
756 return (rsc != NULL) && pcmk__list_of_1(rsc->
running_on)
763 for (GList *ele = rsc->
running_on; ele; ele = ele->next) {
783 GList *retval = NULL;
785 for (GList *gIter = rscs; gIter; gIter = gIter->next) {
793 retval = g_list_prepend(retval, rsc);
810 nodes = g_list_prepend(nodes, strdup(
"*"));
818 nodes = g_list_prepend(nodes, strdup(s));
836 GList *resources = NULL;
839 resources = g_list_prepend(resources, strdup(
"*"));
851 if (strstr(s,
":") != NULL) {
852 resources = g_list_prepend(resources, strdup(rsc->
id));
872 const char *rsc_id = rsc->
id;
878 for (xmlNode *xml_op = pcmk__xml_first_child(rsc->
cluster->
failed); xml_op != NULL;
879 xml_op = pcmk__xml_next(xml_op)) {
880 const char *value = NULL;
896 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.
const pcmk_resource_t * pe__const_top_resource(const pcmk_resource_t *rsc, bool include_bundle)
#define CRM_CHECK(expr, failure_action)
enum pe_quorum_policy no_quorum_policy
Response to loss of quorum.
void destroy_ticket(gpointer data)
#define crm_notice(fmt, args...)
xmlNode * failed
History entries of failed actions.
pcmk_scheduler_t * cluster
Cluster that resource is part of.
#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)
const char * pe_node_attribute_raw(const pcmk_node_t *node, const char *name)
bool crm_time_is_defined(const crm_time_t *t)
Check whether a time object has been initialized yet.
GHashTable * state
XML attributes from ticket state.
const char * pcmk_readable_score(int score)
Return a displayable static string for a score value.
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,...)
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
Whether partition has quorum (via have-quorum property)
GList * children
Resource's child resources, if any.
int count
Counter reused by assignment and promotion code.
gboolean standby
Whether ticket is temporarily suspended.
xmlNode * xml
Resource configuration (possibly expanded from template)
gboolean exclusive_discover
Whether exclusive probing is enabled.
gboolean get_target_role(const pcmk_resource_t *rsc, enum rsc_role_e *role)
Implementation of pcmk_action_t.
#define pcmk__config_err(fmt...)
GHashTable * meta
Resource's meta-attributes.
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)
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)
pcmk_resource_t * container
Resource containing this one, if any.
Always probe resource on node.
Implementation of pcmk_scheduler_t.
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)
#define pe__set_resource_flags(resource, flags_to_set)
GList * resources
Resources in cluster.
GList * nodes
Nodes in cluster.
Also match clone instance ID from resource history.
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)
int weight
Node score for a given resource.
pcmk_resource_t * parent
Resource's parent resource, if any.
Whether any resource provides or requires unfencing (via CIB resources)
time_t get_effective_time(pcmk_scheduler_t *scheduler)
Implementation of pcmk_resource_t.
#define crm_debug(fmt, args...)
Actions are ordered (optionally, if no other flags are set)
#define XML_CIB_ATTR_SHUTDOWN
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 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)
int priority
Configured priority.
void resource_location(pcmk_resource_t *rsc, const pcmk_node_t *node, int score, const char *tag, pcmk_scheduler_t *scheduler)
GList * actions_after
For Pacemaker use only.
bool pcmk_xe_mask_probe_failure(const xmlNode *xml_op)
#define crm_trace(fmt, args...)
pcmk_node_t * pe_find_node(const GList *node_list, const char *node_name)
Find a node by name in a list of nodes.
void * priv
For Pacemaker use only.
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
struct pe_node_shared_s * details
Basic node information.
GList * pe__unames_with_tag(pcmk_scheduler_t *scheduler, const char *tag_name)
unsigned long long flags
Group of enum pcmk_rsc_flags.
const char * uname
Node name in cluster.
bool pe__resource_is_disabled(const pcmk_resource_t *rsc)
Match clone instances (even unique) by base name as well as exact ID.
time_t recheck_by
Hint to controller when to reschedule.
Ticket constraint object.
pcmk_node_t * pe__copy_node(const pcmk_node_t *this_node)
time_t last_granted
When cluster was last granted the ticket.
#define XML_RSC_ATTR_TARGET_ROLE
Implementation of pcmk_node_t.
enum rsc_role_e text2role(const char *role)
gboolean granted
Whether cluster has been granted the ticket.
long long crm_time_get_seconds_since_epoch(const crm_time_t *dt)
int rsc_discover_mode
Probe mode (enum pe_discover_e)
const char * id
Node ID at the cluster layer.
char * id
XML ID of ticket constraint or state.
GList * refs
XML IDs of objects that reference the tag.
gboolean order_actions(pcmk_action_t *lh_action, pcmk_action_t *rh_action, uint32_t flags)
bool pe__is_guest_node(const pcmk_node_t *node)
bool pe__rsc_running_on_only(const pcmk_resource_t *rsc, const pcmk_node_t *node)
gboolean(* active)(pcmk_resource_t *rsc, gboolean all)
Check whether a resource is active.
GList * pe__build_node_name_list(pcmk_scheduler_t *scheduler, const char *s)
Whether resource's class is "stonith".
GHashTable * pcmk__strkey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
pcmk__action_result_t result
pcmk_rsc_methods_t * fns
Resource object methods.
Whether fencing is enabled (via stonith-enabled property)
#define crm_err(fmt, args...)
pcmk_scheduler_t * scheduler
crm_time_t * crm_time_new(const char *string)
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)
Configuration tag object.
pcmk_node_t * allocated_to
Node resource is assigned to.
gboolean shutdown
Whether shutting down.
#define pe__clear_resource_flags(resource, flags_to_clear)
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)
GList * running_on
Nodes where resource may be active.
const char * rsc_printable_id(const pcmk_resource_t *rsc)
int pcmk__add_scores(int score1, int score2)
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)
Whether resource can be promoted and demoted.
Whether cluster has a fencing resource (via CIB resources)
Resource role is unknown.
#define XML_LRM_ATTR_TARGET
char * pcmk__trim(char *str)
#define pe_rsc_trace(rsc, fmt, args...)
unsigned long long flags
Group of enum pcmk_scheduler_flags.
gboolean unclean
Whether node requires fencing.
bool pcmk__rsc_filtered_by_node(pcmk_resource_t *rsc, GList *only_node)
const char * pe__clone_child_id(const pcmk_resource_t *rsc)
Whether resource has been removed from the configuration.
crm_time_t * now
Current time for evaluation purposes.
#define crm_info(fmt, args...)
pcmk_ticket_t * ticket_new(const char *ticket_id, pcmk_scheduler_t *scheduler)
gint pe__cmp_rsc_priority(gconstpointer a, gconstpointer b)
gboolean online
Whether online.
GList * actions_before
For Pacemaker use only.
Whether resource is not an anonymous clone instance.
pcmk_resource_t * remote_rsc
Remote connection resource for node, if it is a Pacemaker Remote node.
No relation (compare with equality rather than bit set)
char * id
Resource ID in configuration.
GHashTable * allowed_nodes
Nodes where resource may run (key is node ID, not name)
gboolean pcmk__str_in_list(const gchar *s, const GList *lst, uint32_t flags)
void crm_time_free(crm_time_t *dt)