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, pcmk__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;
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 (pcmk__is_clone(rsc) && !pcmk__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 = pcmk__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)
427 && !pcmk__is_guest_or_bundle_node(node)))) {
430 "All nodes for resource %s are unavailable, unclean or " 431 "shutting down (%s can%s run resources, with score %s)",
432 rsc->
id, pcmk__node_name(node),
445 changed = (node != NULL);
451 char *rc_stopped = NULL;
460 for (GList *iter = rsc->
actions; iter != NULL; iter = iter->next) {
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) {
500 add_assigned_resource(node, rsc);
508 out->
message(out,
"resource-util", rsc, node, __func__);
532 crm_info(
"Unassigning %s from %s", rsc->
id, pcmk__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) {
604 "threshold (clean up resource to allow again)" 607 rsc_to_ban->
id, pcmk__node_name(node), fail_count,
609 if (failed != NULL) {
610 *failed = rsc_to_ban;
615 crm_info(
"%s can fail %d more time%s on " 616 "%s before reaching migration threshold (%d)",
632 get_node_score(
const pcmk_node_t *node, GHashTable *nodes)
636 if ((node != NULL) && (nodes != NULL)) {
637 found_node = g_hash_table_lookup(nodes, node->
details->
id);
654 cmp_resources(gconstpointer a, gconstpointer b, gpointer
data)
662 const GList *nodes =
data;
669 GHashTable *r1_nodes = NULL;
670 GHashTable *r2_nodes = NULL;
671 const char *reason = NULL;
677 if (r1_score > r2_score) {
681 if (r1_score < r2_score) {
687 reason =
"no node list";
705 reason =
"current location";
707 r1_node = pcmk__current_node(resource1);
710 r2_node = pcmk__current_node(resource2);
712 r1_score = get_node_score(r1_node, r1_nodes);
713 r2_score = get_node_score(r2_node, r2_nodes);
714 if (r1_score > r2_score) {
718 if (r1_score < r2_score) {
725 for (
const GList *iter = nodes; iter != NULL; iter = iter->next) {
728 r1_score = get_node_score(node, r1_nodes);
729 r2_score = get_node_score(node, r2_nodes);
730 if (r1_score > r2_score) {
734 if (r1_score < r2_score) {
741 crm_trace(
"%s (%d)%s%s %c %s (%d)%s%s: %s",
742 resource1->
id, r1_score,
743 ((r1_node == NULL)?
"" :
" on "),
744 ((r1_node == NULL)?
"" : r1_node->
details->
id),
745 ((rc < 0)?
'>' : ((rc > 0)?
'<' :
'=')),
746 resource2->
id, r2_score,
747 ((r2_node == NULL)?
"" :
" on "),
748 ((r2_node == NULL)?
"" : r2_node->
details->
id),
750 if (r1_nodes != NULL) {
751 g_hash_table_destroy(r1_nodes);
753 if (r2_nodes != NULL) {
754 g_hash_table_destroy(r2_nodes);
772 cmp_resources, nodes);
pcmk_assignment_methods_t * cmds
#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...)
G_GNUC_INTERNAL void pcmk__apply_location(pcmk_resource_t *rsc, pcmk__location_t *constraint)
pcmk_scheduler_t * cluster
void(* output_actions)(pcmk_resource_t *rsc)
G_GNUC_INTERNAL void pcmk__group_shutdown_lock(pcmk_resource_t *rsc)
G_GNUC_INTERNAL void pcmk__primitive_create_actions(pcmk_resource_t *rsc)
G_GNUC_INTERNAL int pcmk__group_apply_coloc_score(pcmk_resource_t *dependent, const pcmk_resource_t *primary, const pcmk__colocation_t *colocation, bool for_dependent)
#define PCMK_META_MIGRATION_THRESHOLD
G_GNUC_INTERNAL pcmk_node_t * pcmk__bundle_assign(pcmk_resource_t *rsc, const pcmk_node_t *prefer, bool stop_if_fail)
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,...)
const char * pcmk_readable_score(int score)
Return a displayable static string for a score value.
G_GNUC_INTERNAL void pcmk__release_node_capacity(GHashTable *current_utilization, const pcmk_resource_t *rsc)
#define pcmk__rsc_trace(rsc, fmt, args...)
G_GNUC_INTERNAL void pcmk__bundle_add_utilization(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList *all_rscs, GHashTable *utilization)
#define PCMK__META_OP_TARGET_RC
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 int pcmk__bundle_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__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)
G_GNUC_INTERNAL void pcmk__clone_apply_location(pcmk_resource_t *rsc, pcmk__location_t *constraint)
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)
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)
G_GNUC_INTERNAL bool pcmk__bundle_create_probe(pcmk_resource_t *rsc, pcmk_node_t *node)
G_GNUC_INTERNAL void pcmk__clone_internal_constraints(pcmk_resource_t *rsc)
G_GNUC_INTERNAL void pcmk__bundle_apply_location(pcmk_resource_t *rsc, pcmk__location_t *constraint)
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)
#define pcmk__rsc_debug(rsc, fmt, args...)
G_GNUC_INTERNAL void pcmk__bundle_with_colocations(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
G_GNUC_INTERNAL void pcmk__clone_add_actions_to_graph(pcmk_resource_t *rsc)
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 int 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__primitive_add_graph_meta(const pcmk_resource_t *rsc, xmlNode *xml)
G_GNUC_INTERNAL void pcmk__bundle_internal_constraints(pcmk_resource_t *rsc)
#define pcmk__clear_action_flags(action, flags_to_clear)
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)
G_GNUC_INTERNAL uint32_t pcmk__group_action_flags(pcmk_action_t *action, const pcmk_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
G_GNUC_INTERNAL void pcmk__clone_create_actions(pcmk_resource_t *rsc)
#define PCMK_ACTION_START
GList * pcmk__rscs_matching_id(const char *id, const pcmk_scheduler_t *scheduler)
Wrappers for and extensions to libxml2.
GList *(* colocated_resources)(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList *colocated_rscs)
#define pcmk__set_rsc_flags(resource, flags_to_set)
G_GNUC_INTERNAL pcmk_node_t * pcmk__clone_assign(pcmk_resource_t *rsc, const pcmk_node_t *prefer, bool stop_if_fail)
enum pe_obj_types 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__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__add_rsc_actions_to_graph(pcmk_resource_t *rsc)
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_location(pcmk_resource_t *rsc, pcmk__location_t *location)
#define PCMK_META_INTERVAL
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
G_GNUC_INTERNAL int pcmk__primitive_apply_coloc_score(pcmk_resource_t *dependent, const pcmk_resource_t *primary, const pcmk__colocation_t *colocation, bool for_dependent)
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)
#define pcmk__sched_warn(fmt...)
This structure contains everything that makes up a single output formatter.
pcmk_node_t * allocated_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)
G_GNUC_INTERNAL pcmk_node_t * pcmk__group_assign(pcmk_resource_t *rsc, const pcmk_node_t *prefer, bool stop_if_fail)
pcmk_resource_t * dependent
#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)
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)
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)
#define crm_info(fmt, args...)
#define pcmk__clear_rsc_flags(resource, flags_to_clear)
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)
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 PCMK_SCORE_INFINITY
Integer score to use to represent "infinity".