112 const xmlNode *rsc_entry,
bool active_on_node)
114 bool changed =
false;
115 const char *attr_list[] = {
129 if (active_on_node) {
131 "because %s changed from '%s' to '%s'",
132 rsc->
id, pe__node_name(node), attr_list[i],
133 pcmk__s(old_value,
""), pcmk__s(value,
""));
137 if (changed && active_on_node) {
159 if ((strcmp(rsc->
id,
id) == 0)
163 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
203 set_assignment_methods_for_rsc(gpointer
data, gpointer user_data)
208 g_list_foreach(rsc->
children, set_assignment_methods_for_rsc, NULL);
244 GList *colocated_rscs)
246 const GList *iter = NULL;
247 GList *colocations = NULL;
249 if (orig_rsc == NULL) {
253 if ((rsc == NULL) || (g_list_find(colocated_rscs, rsc) != NULL)) {
254 return colocated_rscs;
257 pe_rsc_trace(orig_rsc,
"%s is in colocation chain with %s",
258 rsc->
id, orig_rsc->
id);
259 colocated_rscs = g_list_prepend(colocated_rscs, (gpointer) rsc);
263 for (iter = colocations; iter != NULL; iter = iter->next) {
267 if (primary == orig_rsc) {
274 add_colocated_resources(primary, orig_rsc, &colocated_rscs);
277 g_list_free(colocations);
281 for (iter = colocations; iter != NULL; iter = iter->next) {
285 if (dependent == orig_rsc) {
289 if (pe_rsc_is_clone(rsc) && !pe_rsc_is_clone(dependent)) {
296 add_colocated_resources(dependent, orig_rsc, &colocated_rscs);
299 g_list_free(colocations);
301 return colocated_rscs;
327 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
337 current = pe__current_node(rsc);
351 out->
message(out,
"rsc-action", rsc, current, next);
407 bool changed =
false;
412 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
423 if (!force && (node != NULL)
430 "All nodes for resource %s are unavailable, unclean or " 431 "shutting down (%s can%s run resources, with score %s)",
432 rsc->
id, pe__node_name(node),
445 changed = (node != NULL);
451 char *rc_stopped = NULL;
460 for (GList *iter = rsc->
actions; iter != NULL; iter = iter->next) {
463 pe_rsc_debug(rsc,
"Updating %s for %s assignment failure",
475 const char *interval_ms_s = NULL;
476 const char *target_rc_s = NULL;
478 interval_ms_s = g_hash_table_lookup(op->
meta,
480 target_rc_s = g_hash_table_lookup(op->
meta,
482 if (rc_stopped == NULL) {
497 pe_rsc_debug(rsc,
"Assigning %s to %s", rsc->
id, pe__node_name(node));
500 add_assigned_resource(node, rsc);
508 out->
message(out,
"resource-util", rsc, node, __func__);
532 crm_info(
"Unassigning %s from %s", rsc->
id, pe__node_name(old));
554 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
574 int fail_count, remaining_tries;
590 if (fail_count <= 0) {
602 if (remaining_tries <= 0) {
603 crm_warn(
"%s cannot run on %s due to reaching migration threshold " 604 "(clean up resource to allow again)" 605 CRM_XS " failures=%d migration-threshold=%d",
606 rsc_to_ban->
id, pe__node_name(node), fail_count,
608 if (failed != NULL) {
609 *failed = rsc_to_ban;
614 crm_info(
"%s can fail %d more time%s on " 615 "%s before reaching migration threshold (%d)",
631 get_node_score(
const pcmk_node_t *node, GHashTable *nodes)
635 if ((node != NULL) && (nodes != NULL)) {
636 found_node = g_hash_table_lookup(nodes, node->
details->
id);
653 cmp_resources(gconstpointer a, gconstpointer b, gpointer
data)
661 const GList *nodes =
data;
668 GHashTable *r1_nodes = NULL;
669 GHashTable *r2_nodes = NULL;
670 const char *reason = NULL;
676 if (r1_score > r2_score) {
680 if (r1_score < r2_score) {
686 reason =
"no node list";
704 reason =
"current location";
706 r1_node = pe__current_node(resource1);
709 r2_node = pe__current_node(resource2);
711 r1_score = get_node_score(r1_node, r1_nodes);
712 r2_score = get_node_score(r2_node, r2_nodes);
713 if (r1_score > r2_score) {
717 if (r1_score < r2_score) {
724 for (
const GList *iter = nodes; iter != NULL; iter = iter->next) {
727 r1_score = get_node_score(node, r1_nodes);
728 r2_score = get_node_score(node, r2_nodes);
729 if (r1_score > r2_score) {
733 if (r1_score < r2_score) {
740 crm_trace(
"%s (%d)%s%s %c %s (%d)%s%s: %s",
741 resource1->
id, r1_score,
742 ((r1_node == NULL)?
"" :
" on "),
743 ((r1_node == NULL)?
"" : r1_node->
details->
id),
744 ((rc < 0)?
'>' : ((rc > 0)?
'<' :
'=')),
745 resource2->
id, r2_score,
746 ((r2_node == NULL)?
"" :
" on "),
747 ((r2_node == NULL)?
"" : r2_node->
details->
id),
749 if (r1_nodes != NULL) {
750 g_hash_table_destroy(r1_nodes);
752 if (r2_nodes != NULL) {
753 g_hash_table_destroy(r2_nodes);
771 cmp_resources, nodes);
pcmk_assignment_methods_t * cmds
Resource assignment methods.
#define CRM_CHECK(expr, failure_action)
G_GNUC_INTERNAL void pcmk__primitive_with_colocations(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
G_GNUC_INTERNAL pcmk_node_t * pcmk__primitive_assign(pcmk_resource_t *rsc, const pcmk_node_t *prefer, bool stop_if_fail)
pcmk_node_t * pe__copy_node(const pcmk_node_t *this_node)
void trigger_unfencing(pcmk_resource_t *rsc, pcmk_node_t *node, const char *reason, pcmk_action_t *dependency, pcmk_scheduler_t *scheduler)
#define crm_notice(fmt, args...)
pcmk_scheduler_t * cluster
Cluster that resource is part of.
void(* output_actions)(pcmk_resource_t *rsc)
#define pe_rsc_debug(rsc, fmt, args...)
G_GNUC_INTERNAL void pcmk__group_shutdown_lock(pcmk_resource_t *rsc)
G_GNUC_INTERNAL void pcmk__primitive_create_actions(pcmk_resource_t *rsc)
Whether action should not be executed.
G_GNUC_INTERNAL pcmk_node_t * pcmk__bundle_assign(pcmk_resource_t *rsc, const pcmk_node_t *prefer, bool stop_if_fail)
const char * pcmk_readable_score(int score)
Return a displayable static string for a score value.
pcmk_resource_t * uber_parent(pcmk_resource_t *rsc)
void pcmk__noop_add_graph_meta(const pcmk_resource_t *rsc, xmlNode *xml)
int(* message)(pcmk__output_t *out, const char *message_id,...)
G_GNUC_INTERNAL void pcmk__release_node_capacity(GHashTable *current_utilization, const pcmk_resource_t *rsc)
enum rsc_role_e role
Resource's current role.
GList * children
Resource's child resources, if any.
int count
Counter reused by assignment and promotion code.
G_GNUC_INTERNAL void pcmk__bundle_add_utilization(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList *all_rscs, GHashTable *utilization)
xmlNode * xml
Resource configuration (possibly expanded from template)
Implementation of pcmk_action_t.
G_GNUC_INTERNAL GList * pcmk__group_colocated_resources(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList *colocated_rscs)
void(* add_colocated_node_scores)(pcmk_resource_t *source_rsc, const pcmk_resource_t *target_rsc, const char *log_id, GHashTable **nodes, const pcmk__colocation_t *colocation, float factor, uint32_t flags)
G_GNUC_INTERNAL void pcmk__with_bundle_colocations(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
void pcmk__output_resource_actions(pcmk_resource_t *rsc)
G_GNUC_INTERNAL void pcmk__with_clone_colocations(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
G_GNUC_INTERNAL uint32_t pcmk__update_ordered_actions(pcmk_action_t *first, pcmk_action_t *then, const pcmk_node_t *node, uint32_t flags, uint32_t filter, uint32_t type, pcmk_scheduler_t *scheduler)
int migration_threshold
Migration threshold.
bool pcmk__rsc_agent_changed(pcmk_resource_t *rsc, pcmk_node_t *node, const xmlNode *rsc_entry, bool active_on_node)
G_GNUC_INTERNAL void pcmk__bundle_shutdown_lock(pcmk_resource_t *rsc)
G_GNUC_INTERNAL void pcmk__group_with_colocations(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
Implementation of pcmk_scheduler_t.
int pe_get_failcount(const pcmk_node_t *node, pcmk_resource_t *rsc, time_t *last_failure, uint32_t flags, const xmlNode *xml_op)
G_GNUC_INTERNAL bool pcmk__node_available(const pcmk_node_t *node, bool consider_score, bool consider_guest)
G_GNUC_INTERNAL void pcmk__clone_with_colocations(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
#define pe__set_resource_flags(resource, flags_to_set)
GList * resources
Resources in cluster.
G_GNUC_INTERNAL bool pcmk__bundle_create_probe(pcmk_resource_t *rsc, pcmk_node_t *node)
GList * nodes
Nodes in cluster.
G_GNUC_INTERNAL void pcmk__clone_internal_constraints(pcmk_resource_t *rsc)
G_GNUC_INTERNAL void pcmk__add_colocated_node_scores(pcmk_resource_t *source_rsc, const pcmk_resource_t *target_rsc, const char *log_id, GHashTable **nodes, const pcmk__colocation_t *colocation, float factor, uint32_t flags)
G_GNUC_INTERNAL void pcmk__bundle_with_colocations(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
Whether to show node and resource utilization (in log or output)
int weight
Node score for a given resource.
G_GNUC_INTERNAL void pcmk__clone_add_actions_to_graph(pcmk_resource_t *rsc)
#define crm_warn(fmt, args...)
G_GNUC_INTERNAL void pcmk__consume_node_capacity(GHashTable *current_utilization, const pcmk_resource_t *rsc)
void pe__set_next_role(pcmk_resource_t *rsc, enum rsc_role_e role, const char *why)
bool pcmk__threshold_reached(pcmk_resource_t *rsc, const pcmk_node_t *node, pcmk_resource_t **failed)
G_GNUC_INTERNAL void pcmk__primitive_apply_coloc_score(pcmk_resource_t *dependent, const pcmk_resource_t *primary, const pcmk__colocation_t *colocation, bool for_dependent)
G_GNUC_INTERNAL void pcmk__primitive_add_graph_meta(const pcmk_resource_t *rsc, xmlNode *xml)
G_GNUC_INTERNAL void pcmk__bundle_internal_constraints(pcmk_resource_t *rsc)
Implementation of pcmk_resource_t.
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
void pcmk__set_assignment_methods(pcmk_scheduler_t *scheduler)
int priority
Configured priority.
#define pe__clear_action_flags(action, flags_to_clear)
G_GNUC_INTERNAL uint32_t pcmk__group_action_flags(pcmk_action_t *action, const pcmk_node_t *node)
#define crm_trace(fmt, args...)
void * priv
For Pacemaker use only.
GHashTable * meta
Meta-attributes relevant to action.
#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.
G_GNUC_INTERNAL void pcmk__clone_apply_coloc_score(pcmk_resource_t *dependent, const pcmk_resource_t *primary, const pcmk__colocation_t *colocation, bool for_dependent)
G_GNUC_INTERNAL void pcmk__clone_create_actions(pcmk_resource_t *rsc)
#define PCMK_ACTION_START
#define XML_AGENT_ATTR_PROVIDER
GList * pcmk__rscs_matching_id(const char *id, const pcmk_scheduler_t *scheduler)
unsigned long long flags
Group of enum pcmk_rsc_flags.
char * clone_name
Resource instance ID in history.
GList *(* colocated_resources)(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList *colocated_rscs)
G_GNUC_INTERNAL pcmk_node_t * pcmk__clone_assign(pcmk_resource_t *rsc, const pcmk_node_t *prefer, bool stop_if_fail)
Implementation of pcmk_node_t.
enum pe_obj_types variant
Resource variant.
G_GNUC_INTERNAL void pcmk__with_primitive_colocations(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
GList * pcmk__colocated_resources(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList *colocated_rscs)
G_GNUC_INTERNAL void pcmk__apply_location(pcmk_resource_t *rsc, pe__location_t *constraint)
Whether resource has pending start action in history.
const char * id
Node ID at the cluster layer.
G_GNUC_INTERNAL void pcmk__clone_add_graph_meta(const pcmk_resource_t *rsc, xmlNode *xml)
G_GNUC_INTERNAL void pcmk__primitive_add_utilization(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList *all_rscs, GHashTable *utilization)
pcmk_action_t * custom_action(pcmk_resource_t *rsc, char *key, const char *task, const pcmk_node_t *on_node, gboolean optional, pcmk_scheduler_t *scheduler)
Create or update an action object.
G_GNUC_INTERNAL void pcmk__group_add_colocated_node_scores(pcmk_resource_t *source_rsc, const pcmk_resource_t *target_rsc, const char *log_id, GHashTable **nodes, const pcmk__colocation_t *colocation, float factor, uint32_t flags)
pcmk_resource_t * primary
G_GNUC_INTERNAL void pcmk__bundle_apply_coloc_score(pcmk_resource_t *dependent, const pcmk_resource_t *primary, const pcmk__colocation_t *colocation, bool for_dependent)
Whether resource has an ignorable failure.
G_GNUC_INTERNAL void pcmk__add_rsc_actions_to_graph(pcmk_resource_t *rsc)
Whether resource has not yet been assigned to a node.
bool pe__is_guest_node(const pcmk_node_t *node)
void pcmk__sort_resources(pcmk_scheduler_t *scheduler)
G_GNUC_INTERNAL enum pcmk__coloc_affects pcmk__colocation_affects(const pcmk_resource_t *dependent, const pcmk_resource_t *primary, const pcmk__colocation_t *colocation, bool preview)
G_GNUC_INTERNAL void pcmk__group_apply_coloc_score(pcmk_resource_t *dependent, const pcmk_resource_t *primary, const pcmk__colocation_t *colocation, bool for_dependent)
G_GNUC_INTERNAL void pcmk__clone_apply_location(pcmk_resource_t *rsc, pe__location_t *constraint)
G_GNUC_INTERNAL GList * pcmk__with_this_colocations(const pcmk_resource_t *rsc)
G_GNUC_INTERNAL void pcmk__bundle_add_actions_to_graph(pcmk_resource_t *rsc)
pcmk__action_result_t result
Whether action is runnable.
pcmk_scheduler_t * scheduler
G_GNUC_INTERNAL void pcmk__with_group_colocations(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
G_GNUC_INTERNAL void pcmk__output_bundle_actions(pcmk_resource_t *rsc)
G_GNUC_INTERNAL void pcmk__clone_shutdown_lock(pcmk_resource_t *rsc)
G_GNUC_INTERNAL GList * pcmk__this_with_colocations(const pcmk_resource_t *rsc)
This structure contains everything that makes up a single output formatter.
#define XML_LRM_ATTR_INTERVAL_MS
pcmk_node_t * allocated_to
Node resource is assigned to.
G_GNUC_INTERNAL uint32_t pcmk__bundle_action_flags(pcmk_action_t *action, const pcmk_node_t *node)
G_GNUC_INTERNAL void pcmk__clone_add_utilization(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList *all_rscs, GHashTable *utilization)
G_GNUC_INTERNAL void pcmk__group_create_actions(pcmk_resource_t *rsc)
GHashTable * utilization
Node utilization attributes.
G_GNUC_INTERNAL pcmk_node_t * pcmk__group_assign(pcmk_resource_t *rsc, const pcmk_node_t *prefer, bool stop_if_fail)
#define pe__clear_resource_flags(resource, flags_to_clear)
pcmk_resource_t * dependent
G_GNUC_INTERNAL void pcmk__group_apply_location(pcmk_resource_t *rsc, pe__location_t *location)
#define pe__show_node_scores(level, rsc, text, nodes, scheduler)
#define pcmk__plural_s(i)
G_GNUC_INTERNAL void pcmk__primitive_shutdown_lock(pcmk_resource_t *rsc)
GList * running_on
Nodes where resource may be active.
G_GNUC_INTERNAL uint32_t pcmk__group_update_ordered_actions(pcmk_action_t *first, pcmk_action_t *then, const pcmk_node_t *node, uint32_t flags, uint32_t filter, uint32_t type, pcmk_scheduler_t *scheduler)
G_GNUC_INTERNAL bool pcmk__probe_rsc_on_node(pcmk_resource_t *rsc, pcmk_node_t *node)
void pcmk__unassign_resource(pcmk_resource_t *rsc)
G_GNUC_INTERNAL GList * pcmk__sort_nodes(GList *nodes, pcmk_node_t *active_node)
G_GNUC_INTERNAL uint32_t pcmk__primitive_action_flags(pcmk_action_t *action, const pcmk_node_t *node)
bool pcmk__assign_resource(pcmk_resource_t *rsc, pcmk_node_t *node, bool force, bool stop_if_fail)
G_GNUC_INTERNAL uint32_t pcmk__clone_action_flags(pcmk_action_t *action, const pcmk_node_t *node)
#define pe_rsc_trace(rsc, fmt, args...)
unsigned long long flags
Group of enum pcmk_scheduler_flags.
GList * allocated_rsc
List of resources assigned to node.
G_GNUC_INTERNAL uint32_t pcmk__instance_update_ordered_actions(pcmk_action_t *first, pcmk_action_t *then, const pcmk_node_t *node, uint32_t flags, uint32_t filter, uint32_t type, pcmk_scheduler_t *scheduler)
Whether resource has been removed from the configuration.
#define crm_info(fmt, args...)
G_GNUC_INTERNAL void pcmk__group_add_utilization(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList *all_rscs, GHashTable *utilization)
G_GNUC_INTERNAL void pcmk__bundle_create_actions(pcmk_resource_t *rsc)
G_GNUC_INTERNAL bool pcmk__clone_create_probe(pcmk_resource_t *rsc, pcmk_node_t *node)
#define XML_ATTR_TE_TARGET_RC
Whether resource is not an anonymous clone instance.
G_GNUC_INTERNAL void pcmk__bundle_apply_location(pcmk_resource_t *rsc, pe__location_t *constraint)
G_GNUC_INTERNAL void pcmk__primitive_internal_constraints(pcmk_resource_t *rsc)
G_GNUC_INTERNAL void pcmk__group_internal_constraints(pcmk_resource_t *rsc)
#define XML_AGENT_ATTR_CLASS
char * id
Resource ID in configuration.